#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, count, x0, y0, x1, y1, x2, y2, x3, y3;
  cin >> a >> x0 >> y0;
  x1 = x0;
  y1 = y0;
  cin >> x2 >> y2;
  count = 0;
  while (a > 1) {
    cin >> x3 >> y3;
    if (x3 != x0 || y3 != y0) {
      if ((x3 == x2 && y3 > y2) && (x2 > x1)) {
        count++;
      } else if ((y3 == y2 && x3 < x2) && (y2 > y1)) {
        count++;
      } else if ((x3 == x2 && y3 < y2) && (x2 < x1)) {
        count++;
      } else if ((y3 == y2 && x3 > x2) && (y2 < y1)) {
        count++;
      }
    }
    x1 = x2;
    y1 = y2;
    x2 = x3;
    y2 = y3;
    a--;
  }
  cout << count;
}
