#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int x, y, num, a, b;
  cin >> num;
  cin >> x >> y;
  vector<char> vec;
  for (int i = 0; i < num; i++) {
    cin >> a >> b;
    if (a == x && b > y) {
      vec.push_back('n');
    } else if (a == x && b < y) {
      vec.push_back('s');
    } else if (a > x && b == y) {
      vec.push_back('e');
    } else {
      vec.push_back('w');
    }
    x = a;
    y = b;
  }
  int res = 0;
  char curr = vec[0];
  for (int i = 1; i < num; i++) {
    if (vec[i] == 'e') {
      if (curr != 'n') {
        res++;
      }
    } else if (vec[i] == 's') {
      if (curr != 'e') {
        res++;
      }
    } else if (vec[i] == 'w') {
      if (curr != 's') {
        res++;
      }
    } else if (vec[i] == 'n') {
      if (curr != 'w') {
        res++;
      }
    }
    curr = vec[i];
  }
  cout << res << endl;
  return 0;
}
