#include using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #define _GLIBCXX_DEBUG #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { int t; cin >> t; while (t--) { ll n; cin >> n; if (abs(n) == 1) { cout << "Yes\n0" << endl; } else { cout << "No" << endl; ll a = n * n + 2 * n + 2; ll b = n * n - 2 * n + 2; ll cnt2 = 0, cnt5 = 0; while (a % 2 == 0) { a /= 2, cnt2++; } while (a % 5 == 0) { a /= 5, cnt5++; } while (b % 2 == 0) { b /= 2, cnt2++; } while (b % 5 == 0) { b /= 5, cnt5++; } cout << min(cnt2, cnt5) << endl; } } return 0; }