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