def solve():
    n = int(input())
    a = list(map(int,input().split()))
    v = [0 for _ in range(70)]
    mod = 1e9+7
    ans = sum(a)*n//1%mod
    for i in a:
        for j in range(70):
            v[j]+=i%2
            i//=2
    for i in a:
        base = 1
        for j in range(70):
            if i%2==1:
                ans = (ans+mod-(base*v[j])%mod)%mod
            i//=2
            base*=2
            base%=mod
    print(int(ans))

if __name__ == "__main__":
    solve()