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

b = 0
for i in range(n-1):
  for j in range(i+1,n):
    c = int(bin(int(bin(a[i]),0) ^ int(bin(a[j]),0)),0)
    b += c
    b = b%(10**9+7)
  

print(b%(10**9+7))