#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  pair<int, int> a[100001];
  for (int i = 0; i <= n; i++) {
    cin >> a[i].first >> a[i].second;
  }
  int count = 0;
  if (a[1].second > a[0].second) {
    for (int i = 1; i < n; i++) {
      if (a[i].first > a[i - 1].first && a[i].second == a[i - 1].second &&
          a[i].first == a[i + 1].first && a[i].second < a[i + 1].second) {
        count++;
      } else if (a[i].first == a[i - 1].first &&
                 a[i].second > a[i - 1].second && a[i].first > a[i + 1].first &&
                 a[i].second == a[i + 1].second) {
        count++;
      } else if (a[i].first < a[i - 1].first &&
                 a[i].second == a[i - 1].second &&
                 a[i].first == a[i + 1].first &&
                 a[i].second > a[i + 1].second) {
        count++;
      } else if (a[i].first == a[i - 1].first &&
                 a[i].second < a[i - 1].second && a[i].first < a[i + 1].first &&
                 a[i].second == a[i + 1].second) {
        count++;
      }
    }
  } else if (a[1].first > a[0].first) {
    for (int i = 1; i < n; i++) {
      if (a[i].first < a[i - 1].first && a[i].second == a[i - 1].second &&
          a[i].first == a[i + 1].first && a[i].second < a[i + 1].second) {
        count++;
      } else if (a[i].first == a[i - 1].first &&
                 a[i].second > a[i - 1].second && a[i].first < a[i + 1].first &&
                 a[i].second == a[i + 1].second) {
        count++;
      } else if (a[i].first > a[i - 1].first &&
                 a[i].second == a[i - 1].second &&
                 a[i].first == a[i + 1].first &&
                 a[i].second > a[i + 1].second) {
        count++;
      } else if (a[i].first == a[i - 1].first &&
                 a[i].second < a[i - 1].second && a[i].first > a[i + 1].first &&
                 a[i].second == a[i + 1].second) {
        count++;
      }
    }
  }
  cout << count << endl;
}
