N, *P = map(int, open(0).read().split())

[print(pow(x - 1, 2)) if x != 2 else print(2) for x in P]