#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, tx, ty, ans = 0;
  vector<int> x, y;
  cin >> n;
  for (int i = 0; i <= n; i++) {
    cin >> tx >> ty;
    x.push_back(tx), y.push_back(ty);
  }
  for (int i = 1; i < n; i++) {
    int fx = x[i + 1], fy = y[i + 1];
    int cx = x[i], cy = y[i];
    int px = x[i - 1], py = y[i - 1];
    if ((fy > cy && cx > px) || (cx > fx && cy > py) || (fy < cy && cx < px) ||
        (fx > cx && cy < py))
      ans++;
  }
  cout << ans << "\n";
  return 0;
}
