n=int(input())
a = list(map(lambda x:format(x,'060b'),map(int,input().split())))

p = 10**9+7
ans = 0

for i in range(60):
    one = 0
    for j in range(n):
        if a[j][59-i]=='1':
            one += 1
    ans += pow(2,i,p)*one*(n-one)

print(ans%p)
