#include <bits/stdc++.h>
using namespace std;
pair<int, int> ar[1005];
int in = 0, l, r;
string s[] = {"lr", "rl", "rl", "lr"};
int main() {
  int n, a, b;
  cin >> n;
  for (int i = 0; i < n + 1; i++) {
    scanf("%d", &a);
    scanf("%d", &b);
    ar[n - i] = make_pair(a, b);
  }
  int dir, i = 1;
  if (ar[1].first > ar[0].first)
    dir = 1;
  else if (ar[1].first == ar[0].first)
    dir = 2;
  else
    dir = 3;
  if (dir == 2)
    while (1)
      ;
  if (dir == 1)
    in = 0;
  else
    in = 1;
  for (int i = 1; i < n; i++) {
    if (s[dir][ar[i + 1] > ar[i]] == 'l') {
      l++;
      dir = (dir - 1 + 4) % 4;
    } else if (s[dir][ar[i + 1] > ar[i]] == 'r') {
      r++;
      dir = (dir + 1) % 4;
    }
  }
  if (in == 0)
    cout << r << endl;
  else
    cout << l << endl;
}
