import itertools
N = int(input())
A = list(map(int,input().split()))

total = 0
combo = list(itertools.combinations(A,2))
mod = 10**9+7
for x,y in combo:
    total += x^y
    total %= mod
print(total)