maximize -(n p^2) + p^2 + n p - 2 p + 1 with respect to p