Submit solution
Points:
12 (partial)
Time limit:
0.6s
Memory limit:
32M
Author:
Problem type
Allowed languages
C, C++, Java, Pascal
Given an array with non-negative integers , find the longest subsequence , where is not .
NOTE: is the bitwise and operation. A subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements. The two adjacent elements in the subsequence don't have to be consecutive in the original array .
Input Specification
The first line consists of one integer .
The second line consists of non-negative integers, .
Output Specification
One integer, the longest length of the subsequence .
Sample Input 1
4
1 2 3 4
Sample Output 1
2
Sample Input 2
8
1 2 1 2 1 2 1 4
Sample Output 2
4
Comments