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

box = [0] * 61
for i in range(n):
    s = bin (a[i])
    for j in range(len(s)-1):
        if s[-j] == '1':
            box[j] += 1
ans = 0
for i in range(1,61):
    ans += box[i] * (n - box[i]) * pow(2,i-1,10**9+7)
print(ans % (10**9+7))