n=int(input()) pary=[int(input()) for _ in range(n)] for p in pary: if p==2: print(2) else: print((p-1)**2)