import itertools
n = int(input())
a = list(map(int,input().split()))
ans = 0
f = list(itertools.combinations(a,2))
for i in range(len(f)):
    add = f[i][0]^f[i][1]
    ans = (ans + add)%1000000007
print(ans)