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