from collections import Counter
import numpy as np

def bi(s):
  return list(map(int, list(np.binary_repr(int(s),width=64))))

mod = 10**9+7
base = 2**np.arange(63,-1,-1) % mod

N=int(input())
A=list(map(bi,input().split()))
count=np.array(A).reshape(N,64).sum(0)

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