#入力値処理
n = int(input())
data = [int(s) for s in input().split()]

ans = 0

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

print(int(ans))