#include <bits/stdc++.h>
using namespace std;
int type(int x0, int y0, int x1, int y1) {
  if (x0 == x1 && y1 > y0)
    return 0;
  else if (x0 == x1 && y1 < y0)
    return 2;
  else if (y0 == y1 && x1 < x0)
    return 1;
  else if (y0 == y1 && x1 > x0)
    return 3;
}
int main() {
  int n;
  cin >> n;
  int x0, y0;
  int x1, y1;
  cin >> x0 >> y0;
  cin >> x1 >> y1;
  int typ = type(x0, y0, x1, y1);
  n--;
  int dang = 0;
  while (n > 0) {
    x0 = x1;
    y0 = y1;
    cin >> x1 >> y1;
    if (type(x0, y0, x1, y1) == (typ + 1) % 4) dang++;
    typ = type(x0, y0, x1, y1);
    n--;
  }
  cout << dang;
  return 0;
}
