for _ in range(int(input())): p = int(input()) if p != 2: print((p - 1) ** 2) else: print(2)