n = int(input())
a = list(map(int, input().split()))
ans = 0
mod = 10**9+7
for i in range(60):
  j = 1<<i
  cnt = 0
  for k in a:
    if j == k&j:
      cnt += 1
  ans += (cnt*(n-cnt))<<i
  ans%= mod
print(ans)