#include <bits/stdc++.h>
using namespace std;
long long int power(long long int a, long long int b) {
  long long int ans = 1;
  while (b > 0) {
    if (b & 1) {
      ans *= a;
    }
    a *= a;
    b /= 2;
  }
  return ans;
}
bool compare(pair<long long int, string> i, pair<long long int, string> j) {
  return (i.first > j.first);
}
pair<long long int, long long int> arr[2000];
int main() {
  long long int n;
  cin >> n;
  for (long long int i = 1; i <= n; i++) {
    scanf("%lld %lld", &arr[i].first, &arr[i].second);
  }
  char curr, next;
  curr = 'N';
  long long int ans = 0;
  for (long long int i = 2; i < n; i++) {
    if (arr[i].first == arr[i + 1].first) {
      if (arr[i].second < arr[i + 1].second) {
        next = 'N';
      } else
        next = 'S';
    } else {
      if (arr[i].first < arr[i + 1].first)
        next = 'E';
      else
        next = 'W';
    }
    if ((curr == 'N' && next == 'W') || (curr == 'S' && next == 'E') ||
        (curr == 'E' && next == 'N') || (curr == 'W' && next == 'S'))
      ans++;
    curr = next;
  }
  cout << ans;
  return 0;
}
