#include <bits/stdc++.h>
using namespace std;
bool isnorth(int x1, int y1, int x2, int y2) {
  if (x1 == x2 && y2 - y1 > 0)
    return true;
  else
    return false;
}
bool issouth(int x1, int y1, int x2, int y2) {
  if (x1 == x2 && y2 - y1 < 0)
    return true;
  else
    return false;
}
bool iswest(int x1, int y1, int x2, int y2) {
  if (y1 == y2 && x2 - x1 > 0)
    return true;
  else
    return false;
}
bool iseast(int x1, int y1, int x2, int y2) {
  if (y1 == y2 && x2 - x1 < 0)
    return true;
  else
    return false;
}
int dir(int x1, int y1, int x2, int y2) {
  if (x1 == x2 && y2 - y1 > 0) return 1;
  if (x1 == x2 && y2 - y1 < 0) return 2;
  if (y1 == y2 && x2 - x1 > 0) return 3;
  if (y1 == y2 && x2 - x1 < 0) return 4;
}
int c, n;
int main() {
  cin >> n;
  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  int x;
  for (int i = 2; i <= n; i++) {
    x = dir(x1, y1, x2, y2);
    x1 = x2;
    y1 = y2;
    cin >> x2 >> y2;
    if (x == 1) {
      if (!iswest(x1, y1, x2, y2)) c++;
    } else if (x == 2) {
      if (!iseast(x1, y1, x2, y2)) c++;
    } else if (x == 3) {
      if (!issouth(x1, y1, x2, y2)) c++;
    } else if (x == 4) {
      if (!isnorth(x1, y1, x2, y2)) c++;
    }
  }
  cout << c;
}
