f(x1)=n, f(x2)=n2, f(x3)=n3.
Then for a polynomial g(x)=f(x)−n we have g(x1)=0, g(x2)=n2−n, g(x3)=n3−n, so g(x)=(x−x1)(x−t) for some integer t. Then we need to find x1,x2,x3,t, such that g(x2)=(x2−x1)(x2−t)=n2−n, g(x3)=(x3−x1)(x3−t)=n3−n. It suffices to have
x2−x1=1, x2−t=n2−n, x3−x1=n, x3−t=(n2−1).
For example, x1=0, x2=1, x3=n and t=−n2+n+1 satisfy these relations. It's easy to check that the polynomial f(x)=x(x+n2−n−1)+n attains the desired values at x=0, x=1, and x=n.