big=10**9+7

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


ret=0
for i in range(n-1):
  for j in range(i+1,n):
    #print("{0}({1}) xor {2}({3}) = {4}".format(a[i],i,a[j],j,a[i]^a[j]))
    ret += (a[i]^a[j])%big

ret = ret%big
print(ret)