#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, ans;
  while (cin >> n) {
    if (n % 2 != 0 || n == 2 || n == 4)
      cout << 0 << endl;
    else {
      ans = (n - (n / 2 + 1)) / 2;
      cout << ans << endl;
    }
  }
}
