N = int(input())
A_list = list(input().split())
output = 0
for i in range(N):
  A =int(A_list[i])
  for j in range(i+1,N):
    B = int(A_list[j])
    output += int(bin(A^B),2)
output %= 1000000000+7
print(output)