checks for negative inputs for sample n