#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 {a}\{a\} of length nn, it satisfies ∀x<n, a[x] & a[x+1]≠0\forall x < n,\ a[x]\ \&\ a[x+1] \neq 0.

Given a sequence {a}\{a\} of length nn, what is the length of the longest interesting subsequence?

Input Format

One line containing an integer 1≤n≤1061\le n \le 10^6.

The next line contains nn integers 1≤ai≤231−11 \le a_i \le 2^{31} - 1.

Output Format

One line containing an integer: the length of the longest interesting subsequence.

Sample Input

3
1 2 3

Sample Output

2