Alright my idea is that, in order to show that ##f_i(q_i, p_i)## is a constant of motion, it would suffice to show that the Hamiltonian is equal to a constant.
Well, the Hamiltonian will be equal to a constant iff:
$$f(q_1, q_2, ..., q_N, p_1, p_2,..., p_N) = \text{constant}$$
Which is what...