import numpy as np
U = 60
MOD = 10**9+7

def two(s):
  b = bin(s)[2:]
  b = "0"*(U-len(b)) + b
  return list(b)

n = int(input())
A = list(map(int, input().split()))
C = np.zeros(U, dtype=np.int64)
T = np.array([1<<i for i in range(U)])
for i in A:
  C += np.array(two(i)[::-1], dtype=np.int64)
ans = (T * ((n-C) * C)).sum()
print(ans%MOD)