#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  long long int n, cv = 0, ans;
  cin >> n;
  if (n > 3 and n % 2 == 0) {
    n = n / 2;
    if (n & 1)
      ans = (int)(n / 2);
    else
      ans = int(n / 2) - 1;
    cout << ans;
  } else
    cout << "0";
}
