#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, c = 0, z, k;
  cin >> n;
  if (n % 2 != 0) {
    cout << "0\n";
    return;
  }
  for (int i = 1;; ++i) {
    z = i * 2;
    k = (n - z) / 2;
    if (i < k)
      c++;
    else
      break;
  }
  cout << c;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  solve();
  return 0;
}
