#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<pair<int, int> > a(n + 1);
  for (int i = 0; i < n + 1; i++) {
    scanf("%d%d", &(a[i].first), &(a[i].second));
  }
  int result = 0;
  for (int i = 1; i < n; i++) {
    pair<int, int> a0 = a[i - 1];
    pair<int, int> a1 = a[i];
    pair<int, int> a2 = a[i + 1];
    if ((a0.first == a1.first) && (a0.second < a1.second) &&
        (a1.first > a2.first) && (a1.second == a2.second)) {
      result++;
    } else if ((a0.first > a1.first) && (a0.second == a1.second) &&
               (a1.first == a2.first) && (a1.second < a2.second)) {
      continue;
    } else if ((a0.first == a1.first) && (a0.second < a1.second) &&
               (a1.first < a2.first) && (a1.second == a2.second)) {
      continue;
    } else if ((a0.first < a1.first) && (a0.second == a1.second) &&
               (a1.first == a2.first) && (a1.second < a2.second)) {
      result++;
    } else if ((a0.first == a1.first) && (a0.second < a1.second) &&
               (a1.first < a2.first) && (a1.second == a2.second)) {
      continue;
    } else if ((a0.first < a1.first) && (a0.second == a1.second) &&
               (a1.first == a2.first) && (a1.second > a2.second)) {
      continue;
    } else if ((a0.first == a1.first) && (a0.second > a1.second) &&
               (a1.first < a2.first) && (a1.second == a2.second)) {
      result++;
    } else if ((a0.first < a1.first) && (a0.second == a1.second) &&
               (a1.first == a2.first) && (a1.second > a2.second)) {
      continue;
    } else if ((a0.first == a1.first) && (a0.second > a1.second) &&
               (a1.first > a2.first) && (a1.second == a2.second)) {
      continue;
    } else if ((a0.first > a1.first) && (a0.second == a1.second) &&
               (a1.first == a2.first) && (a1.second > a2.second)) {
      result++;
    } else if ((a0.first == a1.first) && (a0.second > a1.second) &&
               (a1.first > a2.first) && (a1.second == a2.second)) {
      continue;
    } else if ((a0.first > a1.first) && (a0.second == a1.second) &&
               (a1.first == a2.first) && (a1.second < a2.second)) {
      continue;
    }
  }
  cout << result;
  return 0;
}
