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