mod = 1000000007
n = int(input())
a = list(map(lambda x: format(int(x), 'b'), input().split()))

cnt = [0] * 65

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