#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  n++;
  int *x = new int[n];
  int *y = new int[n];
  char *di = new char[n];
  fill(di, di + n, NULL);
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
  }
  for (int i = 1; i < n; i++) {
    if (x[i - 1] == x[i]) {
      if (y[i - 1] > y[i]) {
        di[i - 1] = 's';
      } else {
        di[i - 1] = 'n';
      }
    } else {
      if (x[i - 1] > x[i]) {
        di[i - 1] = 'w';
      } else {
        di[i - 1] = 'e';
      }
    }
  }
  char temp = di[0];
  int size = strlen(di);
  int count = 0;
  for (int i = 0; i < size - 1; i++) {
    if (temp == 'e') {
      if (di[i + 1] == 'n') count++;
    } else if (temp == 'n') {
      if (di[i + 1] == 'w') count++;
    } else if (temp == 's') {
      if (di[i + 1] == 'e') count++;
    } else {
      if (di[i + 1] == 's') count++;
    }
    temp = di[i + 1];
  }
  cout << count << endl;
  return 0;
}
