import sys
mod = 10 ** 9 + 7
N = int(input())
A = [int(i) for i in sys.stdin.readline().rstrip().split()]
ans = 0
for i in range(60):
  count = sum(1 for data in A if data & (1<<i))
  ans += count * (N-count) * pow(2,i,mod)
print(ans%mod)