On the negative Pell equation