def main():
    MOD = 10**9 + 7
    A_UB = 2**60  # upper bound
    MAX_BIN_LENGTH = len('{:b}'.format(A_UB))

    N = int(input())
    A = list(map(int, input().split(' ')))

    bit = 1
    answer = 0
    for b in range(MAX_BIN_LENGTH):
        a_bits = [a & 1 for a in A]
        one_num = sum(a_bits)
        answer += (one_num * (N - one_num) * bit) % MOD
        answer %= MOD
        bit *= 2
        bit %= MOD
        for i in range(N):
            A[i] >>= 1
    print(answer)


if __name__ == '__main__':
    main()