import itertools

n = input()
l = list(map(int,input().split()))
c = itertools.combinations(l,2)

s = 0

for v in c:
    s += (v[0]^v[1])% (10**9+7)
    if(s >= 10**9+7):
        s = s % (10**9+7)

print(s)
