N person algorithm v1