Changes the way N gets updated, also prints its value at the end