#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  return b == 0 ? a : gcd(b, a % b);
}
long long int lcm(long long int a, long long int b) {
  long long int g = (a * b) / gcd(a, b);
  return g;
}
const int N = 1e9 + 5;
const int MOD = 1e9 + 7;
void swap(char *p, char *q) {
  char temp = *p;
  *p = *q;
  *q = temp;
  return;
}
int main() {
  long long int n, x, y;
  cin >> n;
  vector<pair<long long int, long long int> > v;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    v.push_back(make_pair(x, y));
  }
  long long int cnt = 0;
  for (int i = 1; i < n - 1; i++) {
    if (v[i].second > v[i - 1].second && v[i + 1].first < v[i - 1].first)
      cnt++;
    else if (v[i].second < v[i - 1].second && v[i + 1].first > v[i - 1].first)
      cnt++;
    else if (v[i].second < v[i + 1].second && v[i - 1].first < v[i].first)
      cnt++;
    else if (v[i + 1].second < v[i - 1].second && v[i].first < v[i - 1].first)
      cnt++;
  }
  cout << cnt;
}
