N = int(input())
l = [int(x) for x in input().split()]
num_of_1 = [0] * 60
for i in range(N):
  S = str(format(l[i], 'b'))
  for i in range(len(S)):
    if S[-i-1] == '1':
      num_of_1[i] += 1
ans = 0
for i in range(60):
  ans += num_of_1[i] * (N - num_of_1[i]) * 2 ** i
  ans %= 1000000007
print(ans)