n = int(input())
L = list(map(int,input().split()))
mod = 10**9+7
def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)
bi = [0]*60
for i in range(n):
  k = Base_10_to_n(L[i], 2).zfill(60)
  for j in range(60):
    if k[j] == '1':
      bi[j] += 1
ans = 0
for i in range(60):
  ans += ((2**i)*(bi[59-i]*(n-bi[59-i])))
  ans %= mod
print(ans%mod)
