import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int,input().split()))
mod = 10**9 + 7
ans = 0

ls_bin = []
for i in range(n):
    b = str(bin(a[i]))[2:]
    c = b.zfill(61)
    ls_bin.append(c)
# print(ls_bin)

ans = 0
for j in reversed(range(61)):
    one = 0
    zero = 0
    for i in range(n):
        s = int(ls_bin[i][j])
        if s==0:
            zero += 1
        else:
            one += 1
    ans_bit = zero * one
    ans += (ans_bit)*(2**(60-j)) % mod
print(ans%mod)