N = int(input()) A = list(map(int, input().split())) ans = 0 all = N*(N+1)//2 for keta in range(28): cnt = 0 ng = 0 for i in range(N): if (A[i]>>keta)&1: ng += cnt*(cnt+1)//2 cnt = 0 else: cnt += 1 ng += cnt*(cnt+1)//2 ans += (1<