Given an array of n$n$ integers : A1,A2,...,An$ A_1, A_2,... , A_n$, find the longest size subsequence which satisfies the following property: The xor of adjacent integers in the subsequence must be non-decreasing.

-----Input:-----
- First line contains an integer n$n$, denoting the length of the array. 
- Second line will contain n$n$ space separated integers, denoting the elements of the array.

-----Output:-----
Output a single integer denoting the longest size of subsequence with the given property.

-----Constraints-----
- 1≤n≤103$1 \leq n \leq 10^3$
- 0≤Ai≤1018$0 \leq A_i \leq 10^{18}$

-----Sample Input:-----
8
1 200 3 0 400 4 1 7

-----Sample Output:-----
6

-----EXPLANATION:-----
The subsequence of maximum length is {1, 3, 0, 4, 1, 7} with Xor of adjacent indexes as {2,3,4,5,6} (non-decreasing)

Difficulty: HARD

Solutions:
n = int(input())
l = [int(i) for i in input().split()]
xors = []
for i in range(n):
	for j in range(i + 1, n):
		xors.append([l[i] ^ l[j], (i, j)])
xors.sort()
upto = [0] * n
for i in range(len(xors)):
	(b, c) = (xors[i][1][0], xors[i][1][1])
	upto[c] = max(upto[c], upto[b] + 1)
print(max(upto) + 1)


n = int(input())
l = list(map(int, input().split()))
a = []
for i in range(0, n):
	for j in range(i + 1, n):
		a.append((l[i] ^ l[j], (i, j)))
a.sort()
dp = [0] * n
for i in range(0, len(a)):
	x = a[i][0]
	(left, right) = (a[i][1][0], a[i][1][1])
	dp[right] = max(dp[left] + 1, dp[right])
print(max(dp) + 1)