#include <bits/stdc++.h>
using namespace std;
const long long inf = LONG_MAX;
const long long arr = 1000000;
bool comp(pair<string, long long> a, pair<string, long long> b) {
  return a.second > b.second;
}
int main(void) {
  long long n;
  cin >> n;
  vector<pair<long long, long long> > v;
  for (int i = 0; i < n + 1; i++) {
    long long x, y;
    cin >> x >> y;
    v.push_back({x, y});
  }
  long long ans = 0;
  for (int i = 1; i < n; i++) {
    long long x1 = v[i - 1].first, y1 = v[i - 1].second;
    long long x2 = v[i].first, y2 = v[i].second;
    long long x3 = v[i + 1].first, y3 = v[i + 1].second;
    if (x1 == x2 && y2 > y1) {
      if (x3 < x1 && y3 > y1) ans++;
    }
    if (y1 == y2 && x2 > x1) {
      if (x3 > x1 && y3 > y1) ans++;
    }
    if (x1 == x2 && y2 < y1) {
      if (x3 > x1 && y3 < y1) ans++;
    }
    if (y1 == y2 && x2 < x1) {
      if (x3 < x1 && y3 < y1) ans++;
    }
  }
  cout << ans << '\n';
  return 0;
}
