n = int(input())
A_list = [[int(i) for i in bin(int(A))[2:].zfill(61)] for A in input().split()]
ans = 0
 
for i in range(61):
  one = sum([A_list[j][i] for j in range(n)])
  ans += 2**(60-i) * one * (n-one)
  ans %= 10**9+7
 
print(ans)