Optimal degrees of freedom of the lower extremities for human walking and running