from math import log2
N = int(input())
A = list(map(int,input().split()))
mod = 10**9+7

digits_cnt1 = [0]*60
for ai in A:
    for d in range(int(log2(ai))+1):
        if ai>>d & 1:
            digits_cnt1[d] += 1

ans = 0
for i in range(60):
    ans += digits_cnt1[i]*(N-digits_cnt1[i])*2**i
    ans %= mod
print(ans)