#include <bits/stdc++.h>
using namespace std;
const long long oo = 1e9;
const int N = 2 * 1e5 + 1;
const double eps = 1e-5;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  pair<int, int> a, b, c;
  int x, y, ans = 0;
  cin >> n >> a.first >> a.second >> b.first >> b.second;
  for (int i = 0; i < n - 1; i++) {
    cin >> c.first >> c.second;
    if (a.second == b.second && b.first == c.first && a.first < b.first &&
        b.second < c.second)
      ans++;
    else if (a.first == b.first && b.second == c.second &&
             a.second < b.second && c.first < b.first)
      ans++;
    else if (a.first == b.first && b.second == c.second &&
             a.second > b.second && b.first < c.first)
      ans++;
    else if (a.second == b.second && b.first == c.first && a.first > b.first &&
             b.second > c.second)
      ans++;
    a = b, b = c;
  }
  cout << ans;
}
