The required integers are n=1 and n=2. In the former case, (a1,b1)=(1,−2) is the unique pair of integers satisfying the conditions in the statement; and in the latter, only (a1,b1,a2,b2)=(2,0,−1,−2) and (a1,b1,a2,b2)=(−1,−2,2,0) fit the bill. Verification is routine.
The degree 2n monic polynomial f=∏i=1n(X2+aiX+bi) vanishes at each ak and at each bk. Since these 2n numbers are pairwise distinct and degf=2n, they form the root set of f. Moreover, since the root set of each factor fi=X2+aiX+bi has size at most 2, and the union of these n root sets has size 2n, they must be pairwise disjoint sets of size 2 each. Recall now that f is monic to write f=∏k=1n(X−ak)(X−bk). Consequently, ∏k=1n(X2+akX+bk)=∏k=1n(X−ak)(X−bk).
If no bk is zero, identification of constant terms of both sides yields a1⋯an=1. This is impossible for pairwise distinct integers unless n=1, in which case a1=1, and f=X2+X+b1. This polynomial must vanish at a1=1, so b1=−2. Consequently, f=X2+X−2=(X−1)(X+2)=(X−a1)(X−b1), as required.
If some bk=0, say, b1=0, then a1=0, so f1=X2+a1X does not vanish at a1. Since the root set of f1 has size 2, this forces n≥2. The polynomial equality at the end of the second paragraph now reads (X+a1)∏k=2n(X2+akX+bk)=(X−a1)∏k=2n(X−ak)(X−bk).
Since a1,b2,…,bn are all non-zero, identification of constant terms of both sides above yields a2⋯an=−1. This is impossible for pairwise distinct integers unless n=2 or n=3.
If n=2, then a2=−1, and f1=X2+a1X and f2=X2−X+b2. Recall that the root sets of f1 and f2 are disjoint and both have size 2. Since f2(b1)=f2(0)=b2=b1=0 and f2(b2)=b22=0, the roots of f2 must be a1 and a2, so the other root of f1 must be b2. The condition f2(a2)=0 yields b2=−2, and the condition f1(b2)=0 then yields a1=2. Consequently, (a1,b1,a2,b2)=(2,0,−1,−2).
The other quadruple, (a1,b1,a2,b2)=(−1,−2,2,0), corresponds to the case where b2=0.
Finally, to rule out the case n=3, we may and will assume that a2=−1 and a3=1. Then f1=X2+a1X, f2=X2−X+b2, f3=X2+X+b3, and f=f1f2f3 has the (pairwise distinct) roots a1,a2=−1,a3=1,b1=0,b2 and b3. Since f1(−1)f1(1)=(1−a1)(1+a1)=0, it follows that −1 and 1 are roots of f2f3. Notice that f(1)=b2=0 and f3(−1)=b3=0, so 2+b2=f2(−1)=0=f3(1)=2+b3, i. e., b2=b3. This contradiction settles the case.