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.
#include <bits/stdc++.h>
using namespace std;
void read_file(bool outToFile = true) {}
struct point;
struct vec;
struct line;
struct circle;
struct triangle;
double to_rad(double theta);
double to_deg(double theta);
double dist(point p, point q);
point middle(point p, point q);
point translate(point p, vec u);
double norm_sq(vec u);
double dot(vec u, vec v);
double cross(vec u, vec v);
bool are_parallel(line l, line d);
bool are_same(line l, line d);
double dist_to_line(point p, point a, point b);
bool ccw(point p, point q, point r);
bool collinear(point p, point q, point r);
double angle(point a, point o, point b);
point rotate(point p, double theta, point q);
point intersection(line l, line d);
bool check_range(double v, double l1, double r1, double l2, double r2);
point segment_intersection(point p, point q, point r, point t);
bool point_on_ray(point p, point a, point b);
bool point_on_segment(point p, point a, point b);
point projection(point p, point a, point b);
double dist_to_segment(point p, point a, point b);
point reflection(point p, point a, point b);
line perpendicular(point p, point a, point b);
line bisector(point a, point o, point b);
circle find_circle(point p, point q, double r);
circle in_circle(triangle t);
circle circum_circle(triangle t);
double perimeter(vector<point> P);
double area(vector<point> P);
bool is_convex(vector<point> P);
bool is_in(point p, vector<point> P);
vector<point> cut(vector<point> P, point a, point b);
bool ch_cmp(point a, point b);
vector<point> convex_hull(vector<point> P);
void print(vector<point> P);
struct point {
  double x, y;
  point(double nx = 0, double ny = 0) { x = nx, y = ny; }
  bool operator==(point p) {
    return fabs(x - p.x) <= (1e-3) && fabs(y - p.y) <= (1e-3);
  }
  bool operator!=(point p) {
    return fabs(x - p.x) > (1e-3) || fabs(y - p.y) > (1e-3);
  }
  bool operator<(point p) {
    if (fabs(x - p.x) > (1e-3)) return x < p.x - (1e-3);
    return y < p.y - (1e-3);
  }
  friend istream &operator>>(istream &is, point &p) { return is >> p.x >> p.y; }
  friend ostream &operator<<(ostream &os, point p) {
    return os << p.x << ' ' << p.y;
  }
};
struct vec {
  double x, y;
  vec(double nx = 0, double ny = 0) { x = nx, y = ny; }
  vec(point p, point q) { x = q.x - p.x, y = q.y - p.y; }
  vec operator+(vec u) { return vec(x + u.x, y + u.y); }
  vec operator-(vec u) { return vec(x - u.x, y - u.y); }
  vec operator*(double k) { return vec(k * x, k * y); }
  friend istream &operator>>(istream &is, vec u) { return is >> u.x >> u.y; }
  friend ostream &operator<<(ostream &os, vec u) {
    return os << u.x << ' ' << u.y;
  }
};
struct line {
  double a, b, c;
  line(double na = 0, double nb = 0, double nc = 0) { a = na, b = nb, c = nc; }
  line(point p, point q) {
    double dx = q.x - p.x;
    double dy = q.y - p.y;
    if (fabs(dx) <= (1e-3)) {
      a = 1, b = 0, c = -p.x;
      return;
    }
    a = -dy / dx;
    b = 1.0;
    c = dy / dx * p.x - p.y;
  }
  line(point p, double m) {
    a = -m;
    b = 1.0;
    c = -(a * p.x + p.y);
  }
  pair<point, point> to_points() {
    point p, q;
    if (fabs(b) <= (1e-3))
      p.x = -c / a, q.x = p.x, p.y = 0, q.y = 1;
    else
      p.x = 0, q.x = 1, p.y = -(a * p.x + c), q.y = -(a * q.x + c);
    return make_pair(p, q);
  }
};
struct circle {
  double x, y, r;
  circle(point c = point(0, 0), double nr = 0) { x = c.x, y = c.y, r = nr; }
  int is_in(point p) {
    double dx = p.x - x, dy = p.y - y;
    double d = dx * dx + dy * dy, R = r * r;
    return (d < R - (1e-3)) ? 0 : (fabs(d - R) <= (1e-3)) ? 1 : 2;
  }
  double perimeter(double theta = 360) {
    theta = to_rad(theta);
    return theta * r;
  }
  double area(double theta = 360) {
    theta = to_rad(theta);
    return theta * r * r / 2;
  }
};
struct triangle {
  point A, B, C;
  double a, b, c;
  triangle(double na = 0, double nb = 0, double nc = 0) {
    a = na, b = nb, c = nc;
  }
  triangle(point nA, point nB, point nC) {
    A = nA, B = nB, C = nC;
    c = dist(A, B), a = dist(B, C), b = dist(C, A);
  }
  bool is_triangle() {
    return a + b > c + (1e-3) && b + c > a + (1e-3) && c + a > b + (1e-3);
  }
  double perimeter() { return a + b + c; }
  double area() {
    double s = perimeter() / 2;
    return sqrt(s * (s - a) * (s - b) * (s - c));
  }
};
double to_rad(double theta) { return theta * acos(-1.0) / 180; }
double to_deg(double theta) { return theta * 180 / acos(-1.0); }
double dist(point p, point q) { return hypot(p.x - q.x, p.y - q.y); }
point middle(point p, point q) {
  return point((p.x + q.x) / 2, (p.y + q.y) / 2);
}
point translate(point p, vec u) { return point(p.x + u.x, p.y + u.y); }
double norm_sq(vec u) { return u.x * u.x + u.y * u.y; }
double dot(vec u, vec v) { return u.x * v.x + u.y * v.y; }
double cross(vec u, vec v) { return u.x * v.y - u.y * v.x; }
bool are_parallel(line l, line d) {
  return fabs(l.a - d.a) <= (1e-3) && fabs(l.b - l.b) <= (1e-3);
}
bool are_same(line l, line d) {
  return are_parallel(l, d) && fabs(l.c - d.c) <= (1e-3);
}
double dist_to_line(point p, point a, point b) {
  return dist(p, projection(p, a, b));
}
bool ccw(point p, point q, point r) {
  return cross(vec(p, q), vec(p, r)) > 0 + (1e-3);
}
bool collinear(point p, point q, point r) {
  return fabs(cross(vec(p, q), vec(p, r))) <= (1e-3);
}
double angle(point a, point o, point b) {
  vec oa = vec(o, a), ob = vec(o, b);
  return acos(dot(oa, ob) / sqrt(norm_sq(oa) * norm_sq(ob)));
}
point rotate(point p, double theta, point q = point(0, 0)) {
  vec oq = vec(point(0, 0), q);
  p = translate(p, oq * -1);
  theta = to_rad(theta);
  double x = p.x * cos(theta) - p.y * sin(theta);
  double y = p.x * sin(theta) + p.y * cos(theta);
  p = point(x, y);
  p = translate(p, oq);
  return p;
}
point intersection(line l, line d) {
  if (are_parallel(l, d)) return point((1e100), (1e100));
  point p;
  p.x = (d.b * l.c - l.b * d.c) / (d.a * l.b - l.a * d.b);
  if (fabs(l.b) > (1e-3))
    p.y = -(l.a * p.x + l.c);
  else
    p.y = -(d.a * p.x + d.c);
  return p;
}
bool check_range(double v, double l, double r) {
  if (l > r + (1e-3)) swap(l, r);
  if (fabs(r - l) <= (1e-3)) return fabs(v - l) <= (1e-3);
  return l < v - (1e-3) && v < r - (1e-3);
  return l <= v + (1e-3) && v <= r + (1e-3);
}
point segment_intersection(point p, point q, point r, point t) {
  point c = intersection(line(p, q), line(r, t));
  if (point_on_segment(c, p, q) && point_on_segment(c, r, t)) return c;
  return point((1e100), (1e100));
}
bool point_on_ray(point p, point a, point b) {
  vec ap = vec(a, p), ab = vec(a, b);
  return collinear(p, a, b) && dot(ap, ab) >= -(1e-3);
}
bool point_on_segment(point p, point a, point b) {
  return point_on_ray(p, a, b) && point_on_ray(p, b, a);
}
point projection(point p, point a, point b) {
  vec ap = vec(a, p), ab = vec(a, b);
  double u = dot(ap, ab) / norm_sq(ab);
  return translate(a, ab * u);
}
double dist_to_segment(point p, point a, point b) {
  vec ap = vec(a, p), ab = vec(a, b);
  double u = dot(ap, ab) / norm_sq(ab);
  if (u < 0 - (1e-3)) return dist(p, a);
  if (u > 1 + (1e-3)) return dist(p, b);
  return dist_to_line(p, a, b);
}
point reflection(point p, point a, point b) {
  point c = projection(p, a, b);
  vec pc = vec(p, c);
  return translate(p, pc * 2);
}
line perpendicular(point p, point a, point b) {
  if (!collinear(p, a, b)) return line(p, projection(p, a, b));
  line l = line(a, b);
  if (fabs(l.b) <= (1e-3)) return line(p, point(p.x + 1, p.y));
  if (fabs(l.a) <= (1e-3)) return line(p, point(p.x, p.y + 1));
  return line(p, 1 / l.a);
}
line bisector(point a, point o, point b) {
  double ratio = dist(o, a) / dist(o, b);
  ratio /= ratio + 1;
  vec ab = vec(a, b);
  point c = translate(a, ab * ratio);
  return line(o, c);
}
circle find_circle(point p, point q, double r) {
  point m = middle(p, q);
  vec mp = vec(m, p);
  double mc = r * r - norm_sq(mp);
  if (mc < 0 - (1e-3)) return circle();
  mc = sqrt(mc);
  double u = mc / dist(m, p);
  point c = translate(m, mp * u);
  c = rotate(c, 90, m);
  return circle(c, r);
}
circle in_circle(triangle t) {
  double r = 2 * t.area() / t.perimeter();
  if (fabs(r) <= (1e-3)) return circle();
  line l = bisector(t.B, t.A, t.C);
  line d = bisector(t.C, t.B, t.A);
  point c = intersection(l, d);
  return circle(c, r);
}
circle circum_circle(triangle t) {
  double r = (t.a * t.b * t.c) / (4 * t.area());
  if (fabs(r) <= (1e-3)) return circle();
  line l = perpendicular(middle(t.A, t.B), t.A, t.B);
  line d = perpendicular(middle(t.A, t.C), t.A, t.C);
  point c = intersection(l, d);
  return circle(c, r);
}
point pivot;
double perimeter(vector<point> P) {
  int n = P.size();
  double ret = 0;
  for (int i = 0; i < n - 1; i++) ret += dist(P[i], P[i + 1]);
  return ret;
}
double area(vector<point> P) {
  int n = P.size();
  double ret = 0;
  double x1, x2, y1, y2;
  for (int i = 0; i < n - 1; i++) {
    x1 = P[i].x, x2 = P[i + 1].x;
    y1 = P[i].y, y2 = P[i + 1].y;
    ret += x1 * y2 - x2 * y1;
  }
  ret /= 2, ret = fabs(ret);
  return ret;
}
bool is_convex(vector<point> P) {
  int n = P.size();
  if (n <= 3) return false;
  bool turn = ccw(P[0], P[1], P[2]);
  for (int i = 1; i < n - 1; i++)
    if (ccw(P[i], P[i + 1], P[i + 2 != n ? i + 2 : 1]) != turn) return false;
  return true;
}
bool is_in(point p, vector<point> P) {
  int n = P.size();
  double sum = 0;
  for (int i = 0; i < n - 1; i++)
    if (ccw(P[i], p, P[i + 1]))
      sum += angle(P[i], p, P[i + 1]);
    else
      sum -= angle(P[i], p, P[i + 1]);
  sum = fabs(sum);
  return fabs(sum - 2 * acos(-1.0)) <= (1e-3);
}
vector<point> cut(vector<point> P, point a, point b) {
  int n = P.size();
  vector<point> ret;
  for (int i = 0; i < n; i++) {
    double left1 = cross(vec(a, b), vec(a, P[i]));
    double left2 = (i != n - 1) ? cross(vec(a, b), vec(a, P[i + 1])) : 0;
    if (left1 >= -(1e-3)) ret.push_back(P[i]);
    if (left1 * left2 < -(1e-3))
      ret.push_back(intersection(line(a, b), line(P[i], P[i + 1])));
  }
  if (!ret.empty() && ret.front() != ret.back()) ret.push_back(ret.front());
  return ret;
}
bool ch_cmp(point a, point b) {
  if (collinear(pivot, a, b)) return dist(pivot, a) < dist(pivot, b) - (1e-3);
  double dx1 = a.x - pivot.x, dy1 = a.y - pivot.y;
  double dx2 = b.x - pivot.x, dy2 = b.y - pivot.y;
  return atan2(dy1, dx1) < atan2(dy2, dx2) - (1e-3);
}
vector<point> convex_hull(vector<point> P) {
  int n = P.size();
  if (n <= 3) {
    if (n != 0 && P[0] != P[n - 1]) P.push_back(P[0]);
    return P;
  }
  int idx = 0;
  for (int i = 1; i < n; i++)
    if (P[idx].y > P[i].y + (1e-3) ||
        (fabs(P[idx].y - P[i].y) <= (1e-3) && P[idx].x < P[i].x - (1e-3)))
      idx = i;
  swap(P[0], P[idx]);
  pivot = P[0];
  sort(P.begin() + 1, P.end(), ch_cmp);
  vector<point> ch;
  ch.push_back(P[n - 1]), ch.push_back(P[0]), ch.push_back(P[1]);
  int i = 2;
  while (i < n) {
    int j = ch.size() - 1;
    if (ccw(ch[j - 1], ch[j], P[i]))
      ch.push_back(P[i]), i++;
    else
      ch.pop_back();
  }
  return ch;
}
void print(vector<point> P) {
  int n = P.size();
  cout << endl;
  for (int i = 0; i < n; i++) cout << P[i] << endl;
  cout << endl;
}
int n;
vector<point> P;
int main() {
  read_file();
  while (cin >> n) {
    n++;
    P.resize(n);
    for (int i = 0; i < n; i++) cin >> P[i];
    int ans = 0;
    for (int i = 0; i < n - 1; i++) {
      point p = P[i], q = P[i + 1];
      vec pq = vec(p, q);
      double lOfpq = sqrt(norm_sq(pq));
      pq = pq * (1 / lOfpq) * 0.5;
      point r = translate(q, pq);
      if (is_in(r, P)) ans++;
    }
    cout << ans << endl;
  }
}
