import numpy as np
import copy
mod = 10**9+7
N = int(input())
A = list(map(int,input().split()))
A = np.array(A, dtype = np.int64)
tmp = 0
for i in range(61):
    tmp_1 = sum(A & 1)
    tmp += ((tmp_1)*(N - tmp_1)*(2**i)) % mod
    A >> 1
print(tmp % mod)