def main():
    """"ここに今までのコード"""
import numpy as np
n = int(input())
A=list(map(int, input().split()))

l=np.zeros(60)
for i in range(60):
    for j in range(n):
        l[60-i-1]+=A[j]%2
        A[j]=A[j]//2
         
xor=([n]*60-l)*l                
mod=10**9+7
ans=xor[0]
for j in range(60-1):
    ans=((2*ans)+xor[j+1])%mod
print(int(ans)) 

if __name__ == '__main__':
    main()