N = int(input())
A = list(map(int,input().split()))
ls = [[0 for j in range(N)] for i in range (60)]
mod = 10**9+7

for i,n in enumerate(A):
  for j in range(60):
    d, m = divmod(n,2)
    ls[j][i]=m
    n = d
    if n==0:
      break
      
      
ans = 0
for i in range(60):
  s = sum(ls[i])
  ln = len(ls[i])
  tmp = s * (ln-s) % mod
  ans += tmp * 2**i % mod
  ans %= mod
print(ans)  
  