import sys
input=sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    N=I()
    
    def calc(p):
        if p==2:
            print(2)
        else:
            print((p-1)**2)
            
    
    for _ in range(N):
        p=I()
        calc(p)
        



main()