mod=10**9+7
n=int(input())
a=list(map(int,input().split()))
l=[0 for i in range(60)]
for x in a:
    x=bin(x)[2:]
    col=0
    for b in x[::-1]:
        if b=='1':
            l[col] = l[col]+1
        col+=1
l2=[0 for i in range(60)]
for x in a:
    x=bin(x)[2:]
    x=x.zfill(60)
    col=0
    for b in x[::-1]:
        if b=='0':
            l2[col] = l2[col] + l[col]
        else:
            l2[col] = l2[col] + n - l[col]
        col+=1
cnt=0
c=1
for i in range(60):
    cnt+=l2[i]*c
    c*=2
    c%=mod
print(cnt//2%mod)