mod = 1000000007
n = int(input())
a = list(map(int, input().split()))

cnt = [0] * 65

for x in a:
  i = 0
  while x:
    if x % 2:
      cnt[i] += 1
    x //= 2
    i += 1
      
ans = 0
for i in range(len(cnt)-1, -1, -1):
  ans *= 2
  ans += cnt[i] * (n-cnt[i])
  ans %= mod
  
print(ans)
