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