#include using namespace std; int main() { int n; cin >> n; while (n--) { long long p; cin >> p; cout << (p == 2 ? 2 : (p-1)*(p-1)) << endl; } }