Having
$$P=Nn_1n_2\qquad (n_1+n_2=N),$$
I compute the total derivative $\frac{dP}{dn_1}$ in two ways:
1)
$$\frac{dP}{dn_1}=\frac{d}{dn_1}\Big[(n_1+n_2)n_1n_2\Big]=n_1n_2+(n_1+n_2)n_2$$
2)
$$\frac{dP}{dn_1}=\frac{d}{dn_1}\Big[Nn_1(N-n_1)\Big]=N(N-n_1)-Nn_1$$
Which are not equal after the substitution $N=n_1+n_2$: One gives $2n_1n_2+n_2^2$, while the other gives $n_2^2-n_1^2$.
Where am I going wrong? I am confused.