N = int(input())
A = list(map(int,input().split()))

ans = 0
for i in range(60):
  num_one = len([1 for x in A if x & (1 << i)])
  ans = (ans + (1 << i) * num_one * (N - num_one)) % 1000000007
print(ans)