n = int(input())
a = list(map(int, input().split()))
a = [''.join(str(bin(x)).replace('0b', '')).zfill(60) for x in a]

ans = 0
for i in range(60):
    n0 = 0
    n1 = 0
    for j in a:
        if j[i] == '0':
            n0+=1
        else:
            n1+=1
    ans+=((2**(60-i-1)) * n0 * n1)
    
print(ans%(10**9 + 7))