def solve():
    from sys import stdin
    f_i = stdin
    
    mod = 10 ** 9 + 7
    
    N = int(f_i.readline())
    A = map(int, f_i.readline().split())
    
    bit_count = [0] * 60
    for A_i in A:
        b = 0
        while A_i:
            bit_count[b] += A_i & 1
            A_i >>= 1
            b += 1
    
    ans = 0
    bit = (1 << i for i in range(60))
    for b, c in zip(bit, bit_count):
        ans += b * c * (N - c)
    
    print(ans % mod)

solve()