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