n = int(input())
a = list(map(int,input().split()))
b = []
lenge = 0
for i in range(n):
    b.append(format(a[i],"b"))
    lenge = max(lenge,len(b[i]))
ans = 0
for i in range(lenge):
    zero_count = 0
    one_count = 0
    for j in range(n):
        if len(b[j]) > i:
            if b[j][-1*(i+1)] == "1":
                one_count += 1
            else:
                zero_count += 1
        else:
            zero_count += 1
    ans += zero_count * one_count * (2**i)

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