N = int(input()) P = [int(input()) for _ in range(N)] ans = [0]*N for i in range(N): ans[i] = P[i]**2-2*P[i]+2 print(*ans, sep='\n')