import sys input = sys.stdin.readline N=int(input()) P=[int(input()) for i in range(N)] for p in P: if p==2: print(2) else: print((p-1)*(p-1))