n=int(input()) P=list(map(int, input().split())) for p in P: if p==2: print(2) else: print((p-1)**2)