from collections import Counter
import numpy as np

N=int(input())
A=list(map(int,input().split()))
mod = 10**9+7
base = 2**np.arange(63,-1,-1) % mod

count = np.zeros(64,dtype=int) 
for i in range(N):
  b = list(map(int, list(bin(A[i])[2:])))
  b = np.array([0]*(64-len(b))+b)
  count += b

print((base*count*(N-count)).sum() % mod)