#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, danger = 0;
  string direction;
  cin >> n;
  pair<int, int> t[n + 1];
  cin >> t[0].first >> t[0].second;
  cin >> t[1].first >> t[1].second;
  for (int i = 2; i < n + 1; i++) {
    cin >> t[i].first >> t[i].second;
    direction = "9odem";
    if (t[i - 2].first > t[i - 1].first || t[i - 2].second > t[i - 1].second) {
      direction = "lteli";
    }
    if (direction == "9odem" && t[i].first == t[i - 1].first &&
        t[i].second > t[i - 1].second) {
      danger++;
    }
    if (direction == "9odem" && t[i].second == t[i - 1].second &&
        t[i].first < t[i - 1].first) {
      danger++;
    }
    if (direction == "lteli" && t[i].first == t[i - 1].first &&
        t[i].second < t[i - 1].second) {
      danger++;
    }
    if (direction == "lteli" && t[i].second == t[i - 1].second &&
        t[i].first > t[i - 1].first) {
      danger++;
    }
  }
  cout << danger << endl;
  return 0;
}
