#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, px, py, x, y;
  scanf("%d %d %d", &n, &px, &py);
  vector<int> cd;
  for (int i = 1; i < n; i++) {
    scanf("%d %d", &x, &y);
    if (px != x)
      cd.push_back(x > px ? 1 : 3);
    else
      cd.push_back(y > py ? 0 : 2);
    px = x;
    py = y;
  }
  int anw = 0;
  for (int i = 1; i < cd.size(); i++)
    if ((cd[i] + 1) % 4 == cd[i - 1]) anw++;
  cout << anw << endl;
}
