def solve():
    from sys import stdin
    f_i = stdin
    
    mod = 10 ** 9 + 7
    
    N = int(f_i.readline())
    A = list(map(int, f_i.readline().split()))
    A_max = max(A)
    
    ans = 0
    b = 1
    while A_max:
        next_A = []
        
        zero_cnt = 0
        one_cnt = 0
        
        for A_i in A:
            if A_i & 1:
                one_cnt += 1
            else:
                zero_cnt += 1
            next_A.append(A_i >> 1)
        
        ans += b * one_cnt * zero_cnt
        ans %= mod
        
        b *= 2
        A_max >>= 1
        A = next_A[:]
        
    print(ans)

solve()