import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    A=list(map(int,input().split()))
    mod=10**9+7
    C1=[0]*60
    for a in A:
        ax=a
        for i in range(60):
            if ax&1:C1[i]+=1
            ax>>=1
            if ax==0:break
    ans=0
    for i,c in enumerate(C1):
        ans+=c*(n-c)*2**i%mod
    print(ans%mod)

if __name__=='__main__':
    main()