#include using namespace std; using ll = long long; constexpr char newl = '\n'; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin >> n; for (int i = 0; i < n; i++) { ll p; cin >> p; cout << (p == 2 ? 2 : p * (p - 2) + 1) << newl; } return 0; }