#include <bits/stdc++.h>
using namespace std;
long long a[2][3000];
int main() {
  int i, j, m, group, cnt, carry, n, x;
  while (scanf("%d", &group) != EOF) {
    if (group & 1 || group == 2 || group == 4)
      printf("0\n");
    else {
      group >>= 1;
      if (group & 1)
        printf("%d\n", group >> 1);
      else
        printf("%d\n", (group >> 1) - 1);
    }
  }
  return 0;
}
