#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007LL;
vector<char> v;
int main() {
  int n;
  cin >> n;
  int x, y;
  cin >> x >> y;
  int px = x, py = y;
  for (int i = 1; i <= n; i++) {
    cin >> x >> y;
    if (py == y) {
      if (x > px) {
        v.push_back('R');
      } else {
        v.push_back('L');
      }
    } else {
      if (y > py) {
        v.push_back('U');
      } else {
        v.push_back('D');
      }
    }
    px = x;
    py = y;
  }
  int ans = 0;
  for (int i = 1; i < v.size(); i++) {
    if (v[i - 1] == 'D' && v[i] == 'R') ans++;
    if (v[i - 1] == 'U' && v[i] == 'L') ans++;
    if (v[i - 1] == 'R' && v[i] == 'U') ans++;
    if (v[i - 1] == 'L' && v[i] == 'D') ans++;
  }
  cout << ans << "\n";
  return 0;
}
