n=int(input())
*a=map(int,input().split())
g=[[0] for i in range(n)]*60
mod=10**9+7
for i in range(n):
    for j in range(60):
        if (a[i]>>j)&1:
            g[j][i]=1

cnt=0
for i in range(60):
    now=g[i].count(1)
    cnt+=now*(n-now)*(2**i)
    cnt%=mod

print(cnt)