import sys
input = sys.stdin.readline

N = int(input())
M = 60
*A, = map(lambda x: (bin(int(x))[2:].zfill(M))[::-1],input().split())
A = [list(map(int,a)) for a in A]

mod = 10**9+7

c = [0]*M
for a in A:
    for i,n in enumerate(a):
        if n:c[i]+=1

ans = 0
for a in A:
    for i,n in enumerate(a):
        if n:
            ans += ((1<<i)%mod)*(N-c[i])%mod
        else:
            ans += ((1<<i)%mod)*c[i]%mod
        ans %= mod

ans *= (mod+1)//2
ans %= mod
print(ans)