#include <bits/stdc++.h>
const int STOP = 0;
const int WEST = 1;
const int NORTH = 2;
const int EAST = 3;
const int SOUTH = 4;
int main() {
  int n;
  scanf("%d", &n);
  int px, py;
  int pdir = STOP;
  scanf("%d %d", &px, &py);
  int westDangCnt = 0, eastDangCnt = 0;
  int nx, ny;
  int ndir;
  for (int i = 1; i <= n; i++) {
    scanf("%d %d", &nx, &ny);
    int dirX = nx - px;
    int dirY = ny - py;
    if (dirX > 0)
      ndir = EAST;
    else if (dirX < 0)
      ndir = WEST;
    else if (dirY > 0)
      ndir = NORTH;
    else if (dirY < 0)
      ndir = SOUTH;
    if (pdir != STOP) {
      if (ndir - pdir > 0) {
        if (ndir == SOUTH && pdir == WEST)
          eastDangCnt++;
        else
          westDangCnt++;
      } else {
        if (ndir == WEST && pdir == SOUTH)
          westDangCnt++;
        else
          eastDangCnt++;
      }
    }
    px = nx;
    py = ny;
    pdir = ndir;
  }
  if (ndir == WEST) {
    printf("%d\n", eastDangCnt);
  } else {
    printf("%d\n", westDangCnt);
  }
  return 0;
}
