#include <bits/stdc++.h>
using namespace std;
pair<int, int> a[1003];
int m, n, ans, x;
int main() {
  cin >> n;
  cin >> a[0].first >> a[0].second >> a[1].first >> a[1].second;
  for (int i = 2; i < n + 1; i++) {
    cin >> a[i].first >> a[i].second;
    if (a[i].first == a[i - 1].first && a[i].second > a[i - 1].second)
      x = 0;
    else if (a[i].second == a[i - 1].second && a[i].first < a[i - 1].first)
      x = 1;
    else if (a[i].first == a[i - 1].first && a[i].second < a[i - 1].second)
      x = 2;
    else
      x = 3;
    if (x == (m + 1) % 4) ans++;
    m = x;
  }
  cout << ans;
  return 0;
}
