n = int(input())
al = list(map(int, input().split()))

base_2_cnt = [0]*60 
for a in al:
    for i in range(60):
        if ((a >> i) & 1): base_2_cnt[i] += 1

ans = 0
for i in range(60):
    base_01_comb = base_2_cnt[i] * (n-base_2_cnt[i])
    ans += base_01_comb * (2**i)

print(ans%(10**9+7))