#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, c, d, count = 0;
  char dir = 'n', prev = 'n';
  cin >> n;
  cin >> a >> b;
  for (int i = 0; i < n; i++) {
    cin >> c >> d;
    if (d > b)
      dir = 'n';
    else if (c > a)
      dir = 'e';
    else if (d < b)
      dir = 's';
    else if (c < a)
      dir = 'w';
    if (prev == 'e' && dir == 'n')
      count++;
    else if (prev == 'n' && dir == 'w')
      count++;
    else if (prev == 'w' && dir == 's')
      count++;
    else if (prev == 's' && dir == 'e')
      count++;
    prev = dir;
    a = c;
    b = d;
  }
  cout << count;
  return 0;
}
