n = int(input())
lst = list(map(int,input().split()))
mod = 10**9+7

bit_lst = []
for i in range(n):
    bit_lst.append(format(lst[i], '060b'))
    
ans = 0
for i in range(60):
    tmp = []
    for j in range(n):
        tmp.append(bit_lst[j][i])
    
    cnt_one = tmp.count('1')
    cnt_zero = n - cnt_one
    
    tmp = cnt_one * cnt_zero
    for j in range(59 - i):
        tmp = (tmp * 2) % mod
    ans += tmp
print(ans%mod)