#include <bits/stdc++.h>
const double EPS = 1e-9;
const int MOD = 1000003;
const int INF = 2000 * 1000 * 1000;
using namespace std;
int popcount(int n) {
  bitset<32> b(n);
  return b.count();
}
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
int lcm(int a, int b) {
  int temp = gcd(a, b);
  return temp ? (a / temp * b) : 0;
}
template <typename T>
T modpow(T base, T exp, T modulus) {
  base %= modulus;
  T result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % modulus;
    base = (base * base) % modulus;
    exp >>= 1;
  }
  return result;
}
int main() {
  int n;
  cin >> n;
  bool up = 0, right = 0, down = 0, left = 0, prevup = 0, prevright = 0,
       prevdown = 0, prevleft = 0;
  int a, b, preva, prevb;
  cin >> a >> b;
  preva = a;
  prevb = b;
  int sol = 0;
  for (int i = 1; i < n; i++) {
    up = 0;
    right = 0;
    down = 0;
    left = 0;
    cin >> a >> b;
    if (preva == a) {
      if (b > prevb)
        up = 1;
      else
        down = 1;
    } else if (prevb == b) {
      if (a > preva)
        right = 1;
      else
        left = 1;
    }
    if (i != 1) {
      if (prevright && up)
        sol++;
      else if (down && prevleft)
        sol++;
      else if (right && prevdown)
        sol++;
      else if (left && prevup)
        sol++;
    }
    preva = a;
    prevb = b;
    prevup = up;
    prevright = right;
    prevleft = left;
    prevdown = down;
  }
  cout << sol << endl;
  return 0;
}
