def solve():
    from sys import stdin
    f_i = stdin
    
    mod = 10 ** 9 + 7
    
    N = int(f_i.readline())
    A = tuple(map(int, f_i.readline().split()))
    
    ans = 0
    for i in range(60):
        cnt = sum((A_i >> i) & 1 for A_i in A)
        ans += (1 << i) * cnt * (N - cnt)
    
    print(ans % mod)

solve()