#include <bits/stdc++.h>
using namespace std;
int xt(long long x1, long long y1, long long x2, long long y2) {
  if (y1 < y2) return 1;
  if (y1 > y2) return 2;
  if (x1 < x2) return 3;
  if (x1 > x2) return 4;
}
int main() {
  long long n, x, y, xn, yn, od, nw, ans = 0;
  cin >> n;
  cin >> x >> y;
  cin >> xn >> yn;
  od = xt(x, y, xn, yn);
  x = xn;
  y = yn;
  for (int i = 1; i < n; i++) {
    cin >> xn >> yn;
    nw = xt(x, y, xn, yn);
    if ((od == 1 && nw == 4) || (od == 3 && nw == 1) || (od == 2 && nw == 3) ||
        (od == 4 && nw == 2))
      ans++;
    od = nw;
    x = xn;
    y = yn;
  }
  cout << ans;
}
