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

if __name__ == "__main__":
    solve()