n = int(input())
a = list(map(int,input().split()))
b = [0] * 60
for i in range(len(a)):
  tmp = a[i]
  for j in range(60):
    x = tmp%2
    if x == 1:
      b[j] += 1
    tmp //= 2
tmp = 1
ans = 0
for i in range(60):
  s = (n-b[i])*b[i]
  ans += s*tmp
  ans %= 1000000007
  tmp *= 2
  tmp %= 1000000007
print(ans)
