#include <bits/stdc++.h>
using namespace std;
int n, ar[1000000], ars[1000000], ans = 0;
string s = "";
int main() {
  cin >> n;
  n++;
  for (int i = 0; i < n; i++) scanf("%d%d", &ar[i], &ars[i]);
  for (int i = 0; i < n - 1; i++) {
    if (ar[i] != ar[i + 1]) {
      if (ar[i] < ar[i + 1]) {
        s = s + 'R';
      } else {
        s = s + 'L';
      }
    } else {
      if (ars[i] < ars[i + 1]) {
        s = s + 'U';
      } else {
        s = s + 'D';
      }
    }
  }
  for (int i = 0; i < n - 1; i++) {
    if (s[i] == 'R' && s[i + 1] == 'U') ans++;
    if (s[i] == 'L' && s[i + 1] == 'D') ans++;
    if (s[i] == 'U' && s[i + 1] == 'L') ans++;
    if (s[i] == 'D' && s[i + 1] == 'R') ans++;
  }
  cout << ans;
  return 0;
}
