n = int(input())
import numpy as np
A = np.array(list(map(lambda x:list('{:060b}'.format(int(x))),input().split()))).T
ans = 0
mod = 10**9+7
for d in range(60):
  c = list(A[d]).count('0')
  ans += 2**(59-d)*c*(n-c)
print(ans%mod)