Population dynamics and the length of food chains