N=int(input())
A = list(map(int,input().split()))
l = len(A)
ans=0
for idx, val in enumerate(A):
    if idx == l - 1:
        print(ans%(10**9+7))
        exit()
    for x in range(idx+1, l):
        num = A[idx] ^ A[x]
        ans += num