N = int(input())
a = [int(x) for x in input().split(" ")]
sum = 0
pow = 0
while any(a):
    one = 0
    for i in range(N):
        if a[i] & 1:
            one += 1
        a[i] >>= 1
    sum += one * (N - one) * 2 ** pow
    sum %= (10 ** 9 + 7)
    pow += 1
print(sum)