Problem: Maria participates in a bicycle race.

The speedway takes place on the shores of Lake Lucerne, just repeating its contour. As you know, the lake shore consists only of straight sections, directed to the north, south, east or west.

Let's introduce a system of coordinates, directing the Ox axis from west to east, and the Oy axis from south to north. As a starting position of the race the southernmost point of the track is selected (and if there are several such points, the most western among them). The participants start the race, moving to the north. At all straight sections of the track, the participants travel in one of the four directions (north, south, east or west) and change the direction of movement only in bends between the straight sections. The participants, of course, never turn back, that is, they do not change the direction of movement from north to south or from east to west (or vice versa).

Maria is still young, so she does not feel confident at some turns. Namely, Maria feels insecure if at a failed or untimely turn, she gets into the water. In other words, Maria considers the turn dangerous if she immediately gets into the water if it is ignored.

Help Maria get ready for the competition — determine the number of dangerous turns on the track.

Input

The first line of the input contains an integer n (4 ≤ n ≤ 1000) — the number of straight sections of the track.

The following (n + 1)-th line contains pairs of integers (xi, yi) ( - 10 000 ≤ xi, yi ≤ 10 000). The first of these points is the starting position. The i-th straight section of the track begins at the point (xi, yi) and ends at the point (xi + 1, yi + 1).

It is guaranteed that:

  * the first straight section is directed to the north; 
  * the southernmost (and if there are several, then the most western of among them) point of the track is the first point; 
  * the last point coincides with the first one (i.e., the start position); 
  * any pair of straight sections of the track has no shared points (except for the neighboring ones, they share exactly one point); 
  * no pair of points (except for the first and last one) is the same; 
  * no two adjacent straight sections are directed in the same direction or in opposite directions. 

Output

Print a single integer — the number of dangerous turns on the track.

Examples

Input

6
0 0
0 1
1 1
1 2
2 2
2 0
0 0


Output

1


Input

16
1 1
1 5
3 5
3 7
2 7
2 9
6 9
6 7
5 7
5 3
4 3
4 4
3 4
3 2
5 2
5 1
1 1


Output

6

Note

The first sample corresponds to the picture:

<image>

The picture shows that you can get in the water under unfortunate circumstances only at turn at the point (1, 1). Thus, the answer is 1.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
namespace Smart_IO_Stream {
template <class T_First, class T_Second>
ostream &operator<<(ostream &os, const pair<T_First, T_Second> &p) {
  os << p.first << " " << p.second;
  return os;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  for (int i = 0; i < v.size() - 1; i++) {
    os << v[i] << " ";
  }
  if (!v.empty()) {
    os << v[v.size() - 1];
  }
  return os;
}
template <class T>
ostream &operator<<(ostream &os, const vector<vector<T>> &v) {
  for (int i = 0; i < v.size() - 1; i++) {
    os << v[i];
    os << endl;
  }
  if (!v.empty()) {
    os << v[v.size() - 1];
  }
  return os;
}
template <class T_First, class T_Second>
istream &operator>>(istream &is, pair<T_First, T_Second> &p) {
  is >> p.first >> p.second;
  return is;
}
template <class T>
istream &operator>>(istream &is, vector<T> &v) {
  for (int i = 0; i < v.size(); i++) {
    is >> v[i];
  }
  return is;
}
template <class T>
istream &operator,(istream &is, T &obj) {
  is >> obj;
  return is;
}
template <class T>
ostream &operator,(ostream &os, const T &obj) {
  return (os << obj << " ");
}
enum OutSymb {
  nl,
  ptr,
};
ostream &operator,(ostream &os, OutSymb s) {
  switch (s) {
    case nl:
      os << endl;
      break;
    case ptr:
      os << "-> ";
      break;
    default:
      break;
  }
  return os;
}
}  // namespace Smart_IO_Stream
void set_accuracy(int accure) { cout << setprecision(accure) << fixed; }
namespace defython {
template <class T>
long long sum(vector<T> &v) {
  long long rez = 0;
  for (auto &first : v) {
    rez += first;
  }
  return rez;
}
template <class T>
T max(vector<T> &v) {
  if (v.size() == 0) {
    return NULL;
  }
  T assume_max = v[0];
  for (auto &first : v) {
    if (assume_max < first) {
      assume_max = first;
    }
  }
  return assume_max;
}
}  // namespace defython
namespace typedefs {}
using namespace Smart_IO_Stream;
using namespace typedefs;
namespace geo {
const long double EPS = 0.0000001;
long double to_radians(long double ang_deg) {
  return (ang_deg * 3.1415926F / 180.0);
}
long double to_degrees(long double ang_rad) {
  return (ang_rad * 180.0 / 3.1415926F);
}
bool eq(long double a, long double b = 0) { return abs(a - b) <= EPS; }
class line;
class point;
class point {
 public:
  long double first, second;
  inline point() {}
  inline point(long double _x, long double _y) : first(_x), second(_y) {}
  void set_polar(long double _angle, long double _dist) {
    first = cos(_angle) * _dist;
    second = sin(_angle) * _dist;
  }
  long double length() { return sqrt(first * first + second * second); }
  long double angle() { return atan2(second, first); }
  friend istream &operator>>(istream &is, point &p) {
    is >> p.first >> p.second;
    return is;
  }
  friend point operator-(point p1, point p2) {
    return point(p1.first - p2.first, p1.second - p2.second);
  }
  void operator-=(const point &p) {
    first -= p.first;
    second -= p.second;
  }
  point operator/(long double d) { return point(first / d, second / d); }
  point operator*(long double d) { return point(first * d, second * d); }
  void operator/=(long double d) {
    first /= d;
    second /= d;
  }
  void operator*=(long double d) {
    first *= d;
    second *= d;
  }
  point rotate90() { return point(-second, first); }
  point invert() { return point(-first, -second); }
  void set_length(long double l) {
    long double cur_len = length();
    first /= cur_len;
    second /= cur_len;
    first *= l;
    second *= l;
  }
  long double operator*(const point &p) {
    return (first * p.first + second * p.second);
  }
  long double operator^(point &p) {
    return (first * p.second - second * p.first);
  }
  point operator+(point p) { return point(first + p.first, second + p.second); }
  void operator+=(point p) {
    first += p.first;
    second += p.second;
  }
  friend ostream &operator<<(ostream &os, const point &p) {
    os << p.first << " " << p.second;
    return os;
  }
  bool operator==(point p) {
    return eq(first, p.first) && eq(second, p.second);
  }
  bool operator<(const point &p) const {
    return vector<long double>{first, second} <
           vector<long double>{p.first, p.second};
  }
  long double angle_to(point p) {
    return acos(((*this) * p) / (p.length() * length()));
  }
};
class line {
 public:
  long double a, b, c;
  line() {}
  line(long double _a, long double _b, long double _c) : a(_a), b(_b), c(_c) {}
  line(point p1, point p2) { set_abc(p1, p2); }
  void set_abc(point p1, point p2) {
    point p = p1 - p2;
    a = p.second;
    b = -p.first;
    c = -(a * p1.first + b * p1.second);
  }
  long double equate(point p) const { return a * p.first + b * p.second + c; }
  long double distance(point p) {
    return abs((a * p.first + b * p.second + c) / (point(a, b).length()));
  }
  point intersect(line l) {
    long double first = (-l.b * c + l.c * b) / (a * l.b - b * l.a);
    long double second = (-a * l.c + c * l.a) / (-b * l.a + a * l.b);
    return point(first, second);
  }
  long double get_x(long double second) { return (-b * second - c) / a; }
  long double get_y(long double first) { return (-a * first - c) / b; }
  void move(point dp) {
    point inline_p1;
    point inline_p2;
    if (!eq(b)) {
      assert(!eq(b));
      inline_p1 = point(0, get_y(0));
      inline_p2 = point(1, get_y(1));
    } else {
      assert(!eq(a));
      inline_p1 = point(get_x(0), 0);
      inline_p2 = point(get_x(1), 1);
    }
    inline_p1 += dp;
    inline_p2 += dp;
    set_abc(inline_p1, inline_p2);
  }
  friend ostream &operator<<(ostream &os, line &l) {
    os << l.a << " " << l.b << " " << l.c;
    return os;
  }
  friend istream &operator>>(istream &is, line &l) {
    is >> l.a >> l.b >> l.c;
    return is;
  }
};
class segment {
 public:
  point first, second;
  segment() {}
  segment(point _first, point _second) : first(_first), second(_second) {}
  long double distance(point p) {
    long double cos1 = ((first - second) * (p - second)) /
                       ((first - second).length() * (p - second).length());
    long double cos2 = ((second - first) * (p - first)) /
                       ((second - first).length() * (p - first).length());
    if (cos1 >= 0 && cos2 >= 0) {
      return (line(first, second)).distance(p);
    } else {
      return min((first - p).length(), (second - p).length());
    }
  }
  bool in_segment(point p) {
    return abs((first - second).length() - (first - p).length() -
               (second - p).length()) < EPS;
  }
  bool intersect(segment s) {
    point p = line(s.first, s.second).intersect(line(first, second));
    return this->in_segment(p) && s.in_segment(p);
  }
  friend istream &operator>>(istream &is, segment &s) {
    is >> s.first >> s.second;
    return is;
  }
};
class circle {
 public:
  long double radius;
  point center;
  circle() {}
  circle(point _center, long double _radius)
      : center(_center), radius(_radius) {}
  long double equate(point p) {
    long double first = p.first;
    long double second = p.second;
    return first * first + second * second - radius * radius;
  }
  vector<point> tangent(point p) {
    assert(radius > 0);
    p -= center;
    if (p.length() < radius) {
      return vector<point>();
    }
    if (p.length() == radius) {
      vector<point> rez;
      rez.push_back(p + center);
      return rez;
    }
    vector<point> rez;
    long double tgp_len = sqrt(p.length() * p.length() - radius * radius);
    long double alpha = asin(radius / p.length());
    point sub_center = point(p.first, p.second);
    point inter;
    inter.set_polar(sub_center.angle() + alpha, tgp_len);
    rez.push_back(p - inter + center);
    inter.set_polar(sub_center.angle() - alpha, tgp_len);
    rez.push_back(p - inter + center);
    return rez;
  }
  vector<point> intersects_with_equasion(line l) {
    l.move(center.invert());
    long double a = l.b * l.b + l.a * l.a;
    long double b = 2 * l.b * l.c;
    long double c = l.c * l.c - l.a * l.a * radius * radius;
    long double descr = b * b - 4 * a * c;
    if (descr < 0) return {};
    long double root1 = (-b + sqrt(descr)) / (2 * a);
    long double root2 = (-b - sqrt(descr)) / (2 * a);
    vector<point> rez;
    auto check_root = [&rez, l, descr](long double root, circle _circle) {
      long double first = sqrt(_circle.radius * _circle.radius - root * root);
      long double second = root;
      first = (-l.b * second - l.c) / l.a;
      long double in_equate1 = first * first + second * second;
      long double in_equate1_rez = _circle.radius * _circle.radius;
      if (eq(_circle.equate(point(first, second))) &&
          eq(l.equate(point(first, second)))) {
        rez.push_back(_circle.center + point(first, second));
      }
    };
    check_root(root1, *this);
    check_root(root2, *this);
    if (rez.size() > 1) {
      if (eq(rez[0].first, rez[1].first) && eq(rez[0].second, rez[1].second)) {
        rez.pop_back();
      }
    }
    return rez;
  }
  vector<point> intersects(line l) {
    l.move(center.invert());
    long double min_dist = l.distance(point(0, 0));
    point pt_normal(l.a, l.b);
    pt_normal /= pt_normal.length();
    pt_normal *= min_dist;
    if (!eq(l.equate(pt_normal))) {
      pt_normal = pt_normal.invert();
    }
    if (pt_normal.length() > radius) {
      return {};
    }
    if (eq(min_dist, radius)) {
      return {center + pt_normal};
    }
    long double d = sqrt(radius * radius - min_dist * min_dist);
    point inline_pt(-l.b, l.a);
    inline_pt.set_length(d);
    vector<point> rez;
    rez.push_back(center + pt_normal + inline_pt);
    rez.push_back(center + pt_normal - inline_pt);
    return rez;
  }
  vector<point> intersects(circle c) {
    long double betw_dist = (center - c.center).length();
    if (c.center == center && radius == c.radius) throw "To More Intersections";
    if (betw_dist > c.radius + radius) return {};
    if (betw_dist + radius < c.radius) return {};
    if (betw_dist + c.radius < radius) return {};
    if (eq(betw_dist + c.radius, radius)) {
      point pt(c.center - center);
      pt.set_length(pt.length() + c.radius);
      return {center + pt};
    }
    if (eq(betw_dist + radius, c.radius)) {
      point pt(center - c.center);
      pt.set_length(pt.length() + radius);
      return {c.center + pt};
    }
    if (eq(betw_dist, c.radius + radius)) {
      point pt(c.center - center);
      pt.set_length(radius);
      return {center + pt};
    }
    long double cx = c.radius;
    long double b = (c.center - center).length();
    long double a = radius;
    long double alpha = (a * a + b * b - cx * cx) / (2 * a * b);
    long double d = radius * alpha;
    long double norm_d = sqrt(radius * radius - d * d);
    point pt = c.center - center;
    pt.set_length(d);
    point norm_pt = pt.rotate90();
    norm_pt.set_length(norm_d);
    vector<point> rez;
    rez.push_back(center + pt + norm_pt);
    rez.push_back(center + pt - norm_pt);
    if (eq(rez[0].first, rez[1].first) && eq(rez[0].second, rez[1].second)) {
      rez.pop_back();
    }
    return rez;
  }
  friend istream &operator>>(istream &is, circle &c) {
    is >> c.center >> c.radius;
    return is;
  }
};
template <class T>
T get_value_factor(T first) {
  if (first > (T)0) {
    return (T)1;
  } else if (first < (T)0) {
    return (T)-1;
  }
  return (T)0;
}
class polygon {
 public:
  vector<point> points;
  polygon(vector<point> _points) : points(_points) {}
  bool in_side(point p) {
    long double summary_angle = 0;
    for (int i = 0; i < points.size(); i++) {
      if (segment(points[i], points[(i + 1) % points.size()]).in_segment(p)) {
        return true;
      }
      point p1 = points[i] - p;
      point p2 = points[(i + 1) % points.size()] - p;
      long double sin_alpha = ((p1 ^ p2) / (p1.length() * p2.length()));
      long double factor = get_value_factor(sin_alpha);
      summary_angle += abs(asin(sin_alpha)) * factor;
    }
    return abs(summary_angle) > 1;
  }
  bool in_side_with_ray(point p) {
    point magic_point(123456, 666666);
    segment s(p, magic_point);
    int cnt = 0;
    for (int i = 0; i < points.size(); i++) {
      segment edge(points[i], points[(i + 1) % points.size()]);
      if (edge.in_segment(p) == true) {
        return true;
      }
      cnt += edge.intersect(s);
    }
    return cnt & 1;
  }
  bool is_convex() {
    int n = points.size();
    long double last_turn = 0;
    for (int i = 0; i < n; i++) {
      point p1 = points[i];
      point p2 = points[(i + 1) % n];
      point p3 = points[(i + 2) % n];
      point p = p1 - p2;
      point q = p3 - p2;
      long double sin_alpha = (p ^ q) / (p.length() * q.length());
      if (last_turn == 0) {
        last_turn = get_value_factor(sin_alpha);
        continue;
      }
      if (last_turn != get_value_factor(sin_alpha)) {
        return false;
      }
    }
    return true;
  }
  long double square() {
    long double sq = 0;
    for (int i = 0; i < points.size(); i++) {
      point first = points[i];
      point second = points[(i + 1) % points.size()];
      long double w = second.first - first.first;
      long double up_h = second.second - first.second;
      sq += w * first.second + (w * up_h / 2);
    }
    return abs(sq);
  };
};
line create_line_with_normal(point norm, point p_in_line) {
  long double a = norm.first;
  long double b = norm.second;
  long double c = -(a * p_in_line.first + b * p_in_line.second);
  return line(a, b, c);
}
vector<point> convex_hull(vector<point> points, int kostil_id = 8) {
  point down = points[0];
  int n = points.size();
  if (n == 1) {
    return vector<point>{points[0]};
  }
  int down_ind = 0;
  for (int i = 1; i < n; i++) {
    point p = points[i];
    if (p.second == down.second) {
      if (p.first > down.first) {
        down = p;
        down_ind = i;
      }
    } else if (p.second < down.second) {
      down = p;
      down_ind = i;
    }
  }
  tie(points[down_ind], points[n - 1]) =
      make_tuple(points[n - 1], points[down_ind]);
  points.pop_back();
  for (auto first : points) {
  }
  n = points.size();
  sort(points.begin(), points.end(), [&down, &kostil_id](point a, point b) {
    point p = a - down;
    point q = b - down;
    if (p.angle() == q.angle()) {
      return p.length() < q.length();
    }
    return p.angle() < q.angle();
  });
  vector<point> rez;
  rez.push_back(down);
  rez.push_back(points[0]);
  for (int i = 1; i < n; i++) {
    bool need_iter = true;
    need_iter = true;
    point p1 = rez[rez.size() - 2], p2 = rez[rez.size() - 1];
    point p = p1 - p2;
    point q = points[i] - p2;
    while (((rez.size() >= 2)) && (p ^ q) >= 0) {
      rez.pop_back();
      p1 = rez[rez.size() - 2], p2 = rez[rez.size() - 1];
      p = p1 - p2;
      q = points[i] - p2;
    }
    rez.push_back(points[i]);
  }
  point p1 = rez[rez.size() - 2], p2 = rez[rez.size() - 1];
  point p = p1 - p2;
  point q = down - p2;
  while ((rez.size() >= 3) && (p ^ q) >= 0) {
    rez.pop_back();
    p1 = rez[rez.size() - 2], p2 = rez[rez.size() - 1];
    p = p1 - p2;
    q = down - p2;
  }
  return rez;
}
}  // namespace geo
using namespace geo;
int main(int argc, char *argv[]) {
  int n;
  cin, n;
  vector<point> points(n + 1);
  cin >> points;
  vector<point> tmp_points(points.begin(), points.end() - 1);
  polygon pl(tmp_points);
  int cnt = 0;
  for (int i = 0; i < points.size() - 1; i++) {
    point p1 = points[i];
    point p2 = points[i + 1];
    point t = (p2 - p1);
    t.set_length(t.length() + 0.5);
    t += p1;
    if (pl.in_side_with_ray(t)) {
      cnt++;
    }
  }
  cout << cnt;
  return 0;
}