#include<iostream> using namespace std; int main(int argc, char const *argv[]) { for (int n; cin >> n;) { if (n == 1) cout << 1 << endl; else if (n < 4 || n % 4 != 0) cout << -1 << endl; else cout << (n / 4) + 1 << endl; } return 0; }