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