#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int x, y;
  cin >> x >> y;
  cin >> x >> y;
  int prev_dir = 1;
  int current_dir;
  int ans = 0;
  int border_line = x;
  for (int i = 1; i < n; i++) {
    int nx, ny;
    cin >> nx >> ny;
    if (nx == x) {
      if (ny > y) {
        current_dir = 1;
      } else {
        current_dir = 2;
      }
    } else {
      if (nx > x) {
        current_dir = 4;
      } else {
        current_dir = 3;
      }
    }
    x = nx;
    y = ny;
    if (current_dir == 1 && prev_dir == 4) ans++;
    if (current_dir == 4 && prev_dir == 2) ans++;
    if (current_dir == 2 && prev_dir == 3) ans++;
    if (current_dir == 3 && prev_dir == 1) ans++;
    prev_dir = current_dir;
    border_line = max(border_line, x);
  }
  cout << ans << endl;
  return 0;
}
