N = int(input())
nums = list(map(int, input().split()))

X=0
for i in range(N-1):
    for j in range(N):
        if (j > i):
            X+= nums[i] ^ nums[j]
            
if X< 1000000007:
    print(X)
else:
    print(str(X % (10**9 + 7)))