#include using namespace std; int main() { int t; cin >> t; auto cnt = [](long long x, long long d) -> long long { long long res = 0; while (x % d == 0) { res++; x /= d; } return res; }; while (t--) { long long n; cin >> n; cout << (abs(n) == 1 ? "Yes" : "No") << endl; long long x = n * n + 2LL * n + 2LL, y = n * n - 2LL * n + 2LL; long long two = cnt(x, 2LL) + cnt(y, 2LL), five = cnt(x, 5LL) + cnt(y, 5LL); cout << min(two, five) << endl; } }