import numpy as np
n = int(input())
a = list(map(int,input().split()))
mod = 10**9+7
m2 = [1 for i in range(60)]
for i in range(1,60):
    m2[i] = (m2[i-1]*2)%mod

n1 = np.zeros(60,dtype=int)
for i in a:
    sai = [int(i) for i in str(format(i,'060b'))]
    n1 += sai

ans = 0
for i in range(60):
    ans = (ans+((n1[i]*(n-n1[i]))%mod*m2[59-i])%mod)%mod

print(ans)
