#d1707. 最长有趣子序列
最长有趣子序列
Longest Interesting Subsequence
Problem Description
A sequence is called interesting if and only if the bitwise AND of every two adjacent elements is non-zero.
That is, for a sequence of length , it satisfies .
Given a sequence of length , what is the length of the longest interesting subsequence?
Input Format
One line containing an integer .
The next line contains integers .
Output Format
One line containing an integer: the length of the longest interesting subsequence.
Sample Input
3
1 2 3
Sample Output
2