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;
int double_cmp(double a) {
  if ((((a) > 0 ? (a) : -(a)) < 1.0E-8)) return 0;
  return a > 0 ? 1 : -1;
}
struct Point {
  double x, y;
  Point() {}
  Point(double x, double y) : x(x), y(y) {}
  Point operator-(Point &a) { return Point(x - a.x, y - a.y); }
  bool operator<(const Point &a) const { return atan2(y, x) < atan2(a.y, a.x); }
  bool operator==(const Point &a) const { return x == a.x && y == a.y; }
};
double cross_product(Point a, Point b) { return a.x * b.y - b.x * a.y; }
double cross_product(Point p0, Point p1, Point p2) {
  return cross_product(p1 - p0, p2 - p0);
}
double dot_product(Point a, Point b) { return a.x * b.x + a.y * b.y; }
double dot_product(Point p0, Point p1, Point p2) {
  return dot_product(p1 - p0, p2 - p0);
}
double point_dist(Point a) { return sqrt(a.x * a.x + a.y * a.y); }
double point_dist(Point a, Point b) { return point_dist(a - b); }
struct Line {
  Point a, b;
  Line() {}
  Line(Point a, Point b) : a(a), b(b) {}
  bool operator==(const Line &l) const { return l.a == a && l.b == b; }
};
bool points_inline(Point p1, Point p2, Point p3) {
  return (((cross_product(p1, p2, p3)) > 0
               ? (cross_product(p1, p2, p3))
               : -(cross_product(p1, p2, p3))) < 1.0E-8);
}
bool same_side(Point p1, Point p2, Line l) {
  return double_cmp(cross_product(l.a, p1, l.b) * cross_product(l.a, p2, l.b)) >
         0;
}
bool point_online_inclusive(Point p, Line l) {
  return (((cross_product(p, l.a, l.b)) > 0
               ? (cross_product(p, l.a, l.b))
               : -(cross_product(p, l.a, l.b))) < 1.0E-8) &&
         double_cmp(dot_product(p, l.a, l.b)) <= 0;
}
bool point_online_exclusive(Point p, Line l) {
  return (((cross_product(p, l.a, l.b)) > 0
               ? (cross_product(p, l.a, l.b))
               : -(cross_product(p, l.a, l.b))) < 1.0E-8) &&
         double_cmp(dot_product(p, l.a, l.b)) < 0;
}
bool overlap_exclusive(Line u, Line v) {
  if (u == v || (u.a == v.b && u.b == v.a)) return true;
  if (!points_inline(u.a, u.b, v.a) || !points_inline(u.a, u.b, v.b))
    return false;
  bool ret = point_online_exclusive(u.a, v);
  ret = ret || point_online_exclusive(u.b, v);
  ret = ret || point_online_exclusive(v.a, u);
  ret = ret || point_online_exclusive(v.b, u);
  return ret;
}
bool intersect_inclusive(Line u, Line v) {
  if (!points_inline(u.a, u.b, v.a) || !points_inline(u.a, u.b, v.b))
    return !same_side(u.a, u.b, v) && !same_side(v.a, v.b, u);
  bool ret = point_online_inclusive(u.a, v);
  ret = ret || point_online_inclusive(u.b, v);
  ret = ret || point_online_inclusive(v.a, u);
  ret = ret || point_online_inclusive(v.b, u);
  return ret;
}
double line_length(Line l) { return point_dist(l.a - l.b); }
double point_line_dist(Point a, Line l) {
  return abs(cross_product(l.a - a, l.b - a) / line_length(l));
}
Point intersection_point(Line l1, Line l2) {
  double s1 = cross_product(l1.a, l1.b, l2.a);
  double s2 = cross_product(l1.a, l1.b, l2.b);
  Point ret;
  ret.x = (s1 * l2.b.x - s2 * l2.a.x) / (s1 - s2);
  ret.y = (s1 * l2.b.y - s2 * l2.a.y) / (s1 - s2);
  return ret;
}
struct Polygon {
  Point point[1010];
  int point_num;
};
bool is_convex(Polygon &a) {
  for (int i = 0; i < a.point_num; i++) {
    Point p1 = a.point[(i + 1) % a.point_num] - a.point[i];
    Point p2 = a.point[(i + 2) % a.point_num] - a.point[(i + 1) % a.point_num];
    if (double_cmp(cross_product(p1, p2)) < 0) return false;
  }
  return true;
}
bool point_in_convex(Polygon &a, Point peg) {
  for (int i = 0; i < a.point_num; i++) {
    Point p1 = a.point[(i + 1) % a.point_num] - a.point[i];
    Point p2 = peg - a.point[(i + 1) % a.point_num];
    if (double_cmp(cross_product(p1, p2)) <= 0) return false;
  }
  return true;
}
bool graham_cmp(const Point &a, const Point &b) {
  return a.y < b.y || (a.y == b.y && a.x < b.x);
}
bool graham_ok(Point &a, Point &b, Point &c) {
  return double_cmp(cross_product(a, b, c)) >= 0;
}
int graham(Point point[], int n, Point ret[]) {
  int top = 0;
  sort(point, point + n, graham_cmp);
  for (int i = 0; i < 2; i++) ret[top++] = point[i];
  if (n <= 2) return n;
  for (int i = 2; i < n; i++) {
    while (top >= 2 && graham_ok(ret[top - 1], ret[top - 2], point[i])) top--;
    ret[top++] = point[i];
  }
  int len = top;
  ret[top++] = point[n - 2];
  for (int i = n - 3; i >= 0; i--) {
    while (top > len && graham_ok(ret[top - 1], ret[top - 2], point[i])) top--;
    ret[top++] = point[i];
  }
  return top;
}
bool point_in_polygon(Polygon polygon, Point peg) {
  int n = polygon.point_num;
  double ret = 0;
  for (int i = 0; i < n; i++) {
    Point a = polygon.point[i] - peg;
    Point b = polygon.point[(i + 1) % n] - peg;
    double dot = dot_product(a, b);
    dot /= point_dist(a);
    dot /= point_dist(b);
    ret += acos(dot) * double_cmp(cross_product(a, b));
  }
  return double_cmp(ret) != 0;
}
int n;
Polygon polygon;
void input() {
  scanf("%d", &n);
  polygon.point_num = n;
  for (int i = 0; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    polygon.point[i] = Point(x, y);
  }
}
Point make_point(Point a, Point b) {
  if (double_cmp(a.x - b.x) == 0) {
    return Point(b.x, b.y + double_cmp(b.y - a.y) * 0.5);
  }
  return Point(b.x + double_cmp(b.x - a.x) * 0.5, b.y);
}
int work() {
  int ret = 0;
  for (int i = 0; i < n; i++) {
    Point a = make_point(polygon.point[i], polygon.point[(i + 1) % n]);
    if (point_in_polygon(polygon, a)) ret++;
  }
  return ret;
}
int main() {
  input();
  printf("%d\n", work());
  return 0;
}