#include <bits/stdc++.h>
using namespace std;
const int tinf = (int)1e9 + 7;
const long long inf = (long long)1e18 + 7;
const int N = 1e5 + 5;
long long n, x[10000], y[10000], ans;
int main() {
  {
    ios ::sync_with_stdio(false);
    cin.tie(0);
  }
  cin >> n;
  for (int i = 0; i < n; i++) cin >> x[i] >> y[i];
  for (int i = 1; i < n - 1; i++)
    if (y[i] > y[i - 1] && x[i + 1] < x[i])
      ans++;
    else if (y[i] < y[i - 1] && x[i + 1] > x[i])
      ans++;
    else if (x[i] > x[i - 1] && y[i + 1] > y[i])
      ans++;
    else if (x[i] < x[i - 1] && y[i + 1] < y[i])
      ans++;
  cout << ans;
}
