for i in range(int(input())): n=int(input()) print(2 if n==2 else (n-1)**2)