N = int(input())
binary = [0]*60
for i in input().split():
    i = bin(int(i))[2:][::-1]
    for j in range(len(i)):
        binary[j] += int(i[j])
    
ret = 0
pow2 = 1
for elem in binary:
    m = elem # m < 10**9 + 7
    n = (N - elem) # n < 10**9 + 7
    mn = m * n % (10**9 + 7)
    ret += pow2 * mn % (10**9 + 7)
    pow2 = pow2 * 2 % (10**9 + 7)
print(ret % (10**9 + 7))