#include using namespace std; int t; long long n; bool f[100001]; vector p = { 2 }; int main() { cin >> t; for (long long i = 3; i <= 100000; i += 2) { if (!f[i]) { p.push_back(i); for (long long j = i * i; j <= 100000; j += i) { f[j] = 1; } } } for (int i = 0; i < t; i++) { cin >> n; while (n > 2) { long long u = n, w = 1; for (long long j : p) { if (j * j > u) break; if (u % j == 0) { int v = 1; while (u % j == 0) { u /= j; v++; } w *= v; } } if (u > 1) w *= 2; n -= w; } cout << n << endl; } }