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