#include <bits/stdc++.h>
using namespace std;
int dr[] = {0, 0, 1, -1, 1, 1, -1, -1};
int dc[] = {1, -1, 0, 0, 1, -1, 1, -1};
int main() {
  long n;
  while (cin >> n) {
    if (n % 2 == 1)
      cout << "0\n";
    else {
      n /= 2;
      if (n % 2 == 0) n--;
      n /= 2;
      cout << n << "\n";
    }
  }
  return 0;
}
