N = int(input())
A = list(map(lambda x: format(int(x), "060b"), input().split()))
Num = 10**9 + 7
digit = [[0, 0] for i in range(60)]
for a in A:
  for i in range(60):
    digit[i][int(a[i])] += 1
#print(digit)
ans = 0
for i in range(60):
  ans = (ans * 2 + digit[i][0] * digit[i][1])
print(ans %Num)