change N to N-1