#include <bits/stdc++.h>
using namespace std;
int x[1000 + 1], y[1000 + 1];
void solve() {
  int n;
  cin >> n;
  for (int i = 0; i < n + 1; i++) cin >> x[i] >> y[i];
  int res = 0;
  for (int i = 1; i < n; i++) {
    double X = x[i], Y = y[i];
    int cnt = 0;
    if (x[i - 1] == x[i]) {
      if (y[i] > y[i - 1])
        Y += 0.2;
      else
        Y -= 0.2;
      for (int j = 0; j < n; j++)
        if (x[j] == x[j + 1] && x[j] < x[i] && min(y[j], y[j + 1]) < Y &&
            Y < max(y[j], y[j + 1]))
          cnt++;
      if (cnt % 2 == 1) res++;
    } else {
      if (x[i] > x[i - 1])
        X += 0.2;
      else
        X -= 0.2;
      for (int j = 0; j < n; j++)
        if (y[j] == y[j + 1] && y[j] < y[i] && min(x[j], x[j + 1]) < X &&
            X < max(x[j], x[j + 1]))
          cnt++;
      if (cnt % 2 == 1) res++;
    }
  }
  cout << res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}
