Hamiltonian formulation of N-body theories