n = int(input())
a = list(map(int, input().split()))
mod = 1000000007
res = 0
for i in range(62):
  cnt = 0
  for x in a:
    if (x & (1<<i)) > 0:
      cnt += 1
  res = (res + (cnt * (n-cnt) * (1 << i))) % mod
print(res)