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