sequential version of N body simulation