#include #include using namespace std; int main() { while (1){ int n; cin >> n; if (n == -1) return 0; long ans = 0; for (int i = 1; i <= n; i++) { for (int j = 1;j<= n; j++) { if (sqrt(pow(i, 2) + pow(j, 2)) == n) ans++; } } cout << ans << endl; } return 0; }