import itertools

n = int(input())
a_li = list(map(int,input().split()))

mod = 10**9+7
ans = 0

b_pairs = list(itertools.combinations(a_li,2))

for i,j in b_pairs:
    ans += i^j

ans = ans%mod

print(ans)
