#include <bits/stdc++.h>
using namespace std;
std::vector<pair<int, int> > points;
char nextDir(int in) {
  if (points[in + 1].first == points[in].first) {
    if (points[in + 1].second >= points[in].second)
      return 'n';
    else
      return 's';
  }
  if (points[in + 1].second == points[in].second) {
    if (points[in + 1].first >= points[in].first)
      return 'e';
    else
      return 'w';
  }
}
bool isLeft(char dir, char ndir) {
  if (dir == 'n' && ndir == 'w') return 1;
  if (dir == 'w' && ndir == 's') return 1;
  if (dir == 's' && ndir == 'e') return 1;
  if (dir == 'e' && ndir == 'n') return 1;
  return 0;
}
int main() {
  std::ios::sync_with_stdio(false);
  int n;
  cin >> n;
  points = std::vector<pair<int, int> >(n);
  for (int i = 0; i < n; i++) {
    cin >> points[i].first >> points[i].second;
  }
  int ans = 0;
  char dir = 'n';
  for (int i = 0; i < n - 1; i++) {
    char ndir = nextDir(i);
    if (ndir == dir) continue;
    if (isLeft(dir, ndir)) {
      ans++;
    }
    dir = ndir;
  }
  cout << ans;
}
