How many numbers n are there between 1 and 1000 such that both n and n^2-2 are prime?