#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, tmp1, tmp2, t3, t4;
  cin >> n;
  vector<pair<int, int> > v;
  for (int i = 0; i <= n - 1; i++) {
    cin >> tmp1 >> tmp2;
    v.push_back(make_pair(tmp1, tmp2));
  }
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    if ((v[i].second == v[i - 1].second && v[i].first > v[i - 1].first) &&
        (v[i].second < v[i + 1].second && v[i].first == v[i + 1].first))
      cnt++;
    else if ((v[i - 1].second > v[i].second && v[i].first == v[i - 1].first) &&
             (v[i].second == v[i + 1].second && v[i].first < v[i + 1].first))
      cnt++;
    else if ((v[i - 1].second == v[i].second && v[i].first < v[i - 1].first) &&
             (v[i].second > v[i + 1].second && v[i].first == v[i + 1].first))
      cnt++;
    else if ((v[i - 1].second < v[i].second && v[i].first == v[i - 1].first) &&
             (v[i].second == v[i + 1].second && v[i].first > v[i + 1].first))
      cnt++;
  }
  cout << cnt;
  return 0;
}
