#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
struct point {
  int x;
  int y;
} lst;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  int bx, by;
  cin >> bx >> by;
  char last = 'u', crr = 'u';
  int ans = 0;
  lst.x = bx;
  lst.y = by;
  for (int i = 0; i < n - 1; ++i) {
    cin >> bx >> by;
    if (bx > lst.x && by == lst.y)
      crr = 'r';
    else if (bx < lst.x && by == lst.y)
      crr = 'l';
    else if (bx == lst.x && by > lst.y)
      crr = 'u';
    else
      crr = 'd';
    if (last == 'u')
      ans += (crr == 'l');
    else if (last == 'd')
      ans += (crr == 'r');
    else if (last == 'r')
      ans += (crr == 'u');
    else
      ans += (crr == 'd');
    lst.x = bx;
    lst.y = by;
    last = crr;
  }
  cin >> bx >> by;
  cout << ans << "\n";
  return 0;
}
