#include <bits/stdc++.h>
using namespace std;
int d = 0, n, px, py, x, y, ans;
int main() {
  scanf("%d %d %d", &n, &px, &py);
  for (int i = 1; i <= n; i++) {
    scanf("%d %d", &x, &y);
    int cur;
    if (x == px && y > py)
      cur = 0;
    else if (x == px)
      cur = 2;
    else if (y == py && x > px)
      cur = 1;
    else
      cur = 3;
    if (d == 0 && cur == 3)
      ans++;
    else if (d == 1 && cur == 0)
      ans++;
    else if (d == 2 && cur == 1)
      ans++;
    else if (d == 3 && cur == 2)
      ans++;
    d = cur;
    px = x;
    py = y;
  }
  printf("%d\n", ans);
  return 0;
}
