#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 + 10;
int x[maxn], y[maxn], d[maxn];
inline bool check(int d, int i, int j) {
  if (d == 0)
    return y[j] == y[j - 1] && y[j] > y[i] &&
           ((min(x[j], x[j - 1]) < x[i] && x[i] < max(x[j], x[j - 1])) ||
            x[i] == min(x[j], x[j - 1]));
  else if (d == 1)
    return y[j] == y[j - 1] && y[j] < y[i] &&
           ((min(x[j], x[j - 1]) < x[i] && x[i] < max(x[j], x[j - 1])) ||
            x[i] == min(x[j], x[j - 1]));
  else if (d == 2)
    return x[j] == x[j - 1] && x[j] > x[i] &&
           ((min(y[j], y[j - 1]) < y[i] && y[i] < max(y[j], y[j - 1])) ||
            y[i] == min(y[j], y[j - 1]));
  else
    return x[j] == x[j - 1] && x[j] < x[i] &&
           ((min(y[j], y[j - 1]) < y[i] && y[i] < max(y[j], y[j - 1])) ||
            y[i] == min(y[j], y[j - 1]));
}
int main() {
  int n;
  while (~scanf("%d", &n)) {
    n++;
    for (int i = 0; i < n; i++) scanf("%d%d", &x[i], &y[i]);
    for (int i = 1; i < n; i++) {
      if (x[i] == x[i - 1]) {
        if (y[i] > y[i - 1])
          d[i] = 0;
        else
          d[i] = 1;
      } else {
        if (x[i] > x[i - 1])
          d[i] = 2;
        else
          d[i] = 3;
      }
    }
    int ans = 0;
    for (int i = 2; i < n; i++) {
      int cnt = 0;
      if (d[i] != d[i - 1]) {
        for (int j = 1; j < n; j++)
          if (check(d[i - 1], i - 1, j)) cnt++;
        if (cnt % 2 == 1) {
          ans++;
        }
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
