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