def main():
    n=int(input())
    a=list(map(int,input().split()))
    ans=0
    temp=0
    MOD=10**9+7
    leng=0
    bin_a=[[0] * n for i in range(60)]
    for i in range(n):
        tmp=str(bin(a[i]))
        # print(a[i])
        # print(len(tmp))
        leng=max(leng,len(tmp))
        for j in range(len(tmp)-2):
            if tmp[len(tmp)-j-1] == 'b':
                break
            # print(tmp[len(tmp)-i-1])
            bin_a[j][i]=int(tmp[len(tmp)-j-1])

    for i in range(leng):
        cnt1=sum(bin_a[i])
        cnt0=n-cnt1
        ans+=cnt1*cnt0*2**i%MOD
    print(ans%MOD)

if __name__=='__main__':
    main()
