n = int(input())
a = map(int, input().split())
digits = [0]*60
for i in a:
  for j in range(60):
    digits[j] += i%2
    i//=2
    if i==0:
      break
ans = 0
for i in range(60):
  ans += digits[i]*(n-digits[i])*(2**i)
  ans %= 10**9+7
print(ans)