#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int ans = 0;
  cin >> n;
  vector<int> px;
  vector<int> py;
  for (int q = 0; q <= n; q++) {
    int x, y;
    cin >> x >> y;
    px.push_back(x);
    py.push_back(y);
  }
  int predx = px[n - 1], predy = py[n - 1];
  for (int q = 0; q < n - 1; q++) {
    if (px[q] - predx == 0 && py[q] - predy > 0 && px[q + 1] - px[q] < 0) {
      ans++;
    }
    if (px[q] - predx == 0 && py[q] - predy < 0 && px[q + 1] - px[q] > 0) {
      ans++;
    }
    if (px[q] - predx > 0 && py[q] - predy == 0 && py[q + 1] - py[q] > 0) {
      ans++;
    }
    if (px[q] - predx < 0 && py[q] - predy == 0 && py[q + 1] - py[q] < 0) {
      ans++;
    }
    predx = px[q];
    predy = py[q];
  }
  cout << ans;
}
