#include <bits/stdc++.h>
char road[1001];
int n, count;
void readinp() {
  FILE *inp = stdin;
  fscanf(inp, "%d ", &n);
  int i, a, b, c, d;
  fscanf(inp, "%d %d ", &a, &b);
  for (i = 0; i < n; i++) {
    fscanf(inp, "%d %d ", &c, &d);
    if (c == a) {
      if (d > b)
        road[count++] = 'N';
      else
        road[count++] = 'S';
    } else {
      if (c > a)
        road[count++] = 'R';
      else
        road[count++] = 'L';
    }
    a = c;
    b = d;
  }
  int tot = 0;
  for (i = 1; i < count; i++) {
    if (road[i] == 'R' && road[i - 1] == 'S') tot++;
    if (road[i] == 'L' && road[i - 1] == 'N') tot++;
    if (road[i] == 'N' && road[i - 1] == 'R') tot++;
    if (road[i] == 'S' && road[i - 1] == 'L') tot++;
  }
  printf("%d\n", tot);
}
int main(void) {
  readinp();
  return 0;
}
