# import sys
# input = sys.stdin.readline
n = int(input())
a = list(map(int,input().split()))
a = list(set(a))
mod = 10**9 + 7
ans = 0
l = len(a)
for i in range(l-1):
    for j in range(i,l):
        ans += (a[i]^a[j]) % mod
print(ans%mod)