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.
import java.util.Arrays;
import java.util.Scanner;

public class MainD {
	MyScanner sc = new MyScanner();
	Scanner sc2 = new Scanner(System.in);
	long start = System.currentTimeMillis();
	long fin = System.currentTimeMillis();
	final int MOD = 1000000007;
	int[] dx = { 1, 0, 0, -1 };
	int[] dy = { 0, 1, -1, 0 };

	void run() {
		int n = sc.nextInt() + 1;
		Point[] p = new Point[n];
		for (int i = 0; i < n; i++) {
			p[i] = new Point(sc.nextDouble(), sc.nextDouble());
		}
		int cnt = 0;
		for (int i = 0; i < n - 2; i++) {
			Point p1 = p[i];
			Point p2 = p[i + 1];
			Point p3 = p[(i + 2) % n];
			if (ccw(p1, p2, p3) == 1) cnt++;
		}
		System.out.println(cnt);
	}

	double EPS = 1e-8;

	class Point implements Comparable<Point> {
		double x;
		double y;

		public Point(double x, double y) {
			super();
			this.x = x;
			this.y = y;
		}

		@Override
		public int compareTo(Point arg0) {
			if (this.x == arg0.x)
				return this.y - arg0.y > 0 ? 1 : -1;
			if (this.x - arg0.x > 0)
				return 1;
			else
				return -1;
		}
	}

	public Point[] pointArray(int n) {
		Point[] res = new Point[n];
		for (int i = 0; i < n; i++)
			res[i] = new Point(sc.nextDouble(), sc.nextDouble());
		return res;
	}

	// 線分p1->p2と線分p3->p4が交差しているかを判定 true->交差(=含みで接する含む) false->交差せず
	boolean lineCross(Point p1, Point p2, Point p3, Point p4) {
		double a = (p1.x - p2.x) * (p3.y - p1.y) + (p1.y - p2.y) * (p1.x - p3.x);
		double b = (p1.x - p2.x) * (p4.y - p1.y) + (p1.y - p2.y) * (p1.x - p4.x);
		double c = (p3.x - p4.x) * (p1.y - p3.y) + (p3.y - p4.y) * (p3.x - p1.x);
		double d = (p3.x - p4.x) * (p2.y - p3.y) + (p3.y - p4.y) * (p3.x - p2.x);
		return a * b <= 0 && c * d <= 0;
	}

	// 線分p1->p2と直線p3->p4が交差しているかを判定 true->交差(=含みで接する含む) false->交差せず
	boolean lineCross2(Point p1, Point p2, Point p3, Point p4) {
		double a = (p3.x - p4.x) * (p1.y - p3.y) + (p3.y - p4.y) * (p3.x - p1.x);
		double b = (p3.x - p4.x) * (p2.y - p3.y) + (p3.y - p4.y) * (p3.x - p2.x);
		return a * b <= 0;
	}

	// 0 : 任意の2点が重複
	// 1 : p1 -> p2 -> p3 が反時計回り(counter clockwise)
	// 2 : p1 -> p2 -> p3 が時計回り(clockwise)
	// 3 : p1 -> p2 -> p3 の直線
	// 4 : p2 -> p1 -> p3 の直線
	// 5 : p1 -> p3 -> p2 の直線
	int ccw(Point p1, Point p2, Point p3) {
		if (p1.x == p2.x && p1.y == p2.y || p2.x == p3.x && p2.y == p3.y || p3.x == p1.x && p3.y == p1.x)
			return 0;
		Point a = new Point(p2.x - p1.x, p2.y - p1.y);
		Point b = new Point(p3.x - p1.x, p3.y - p1.y);
		if (crossProduct(a, b) > EPS)
			return 1;
		if (crossProduct(a, b) < -EPS)
			return 2;
		if (norm(a) < norm(b))
			return 3;
		if (dot(a, b) < 0)
			return 4;
		else
			return 5;
	}

	// 点o -> 直線abとの距離
	double pointToLine(Point o, Point a, Point b) {
		Point subBA = new Point(b.x - a.x, b.y - a.y);
		Point subOA = new Point(o.x - a.x, o.y - a.y);
		return Math.abs(crossProduct(subBA, subOA) / Math.hypot(subBA.x, subBA.y));
	}

	// 点o -> 線分abとの距離
	double pointToLineSegment(Point o, Point a, Point b) {
		Point subAB = new Point(a.x - b.x, a.y - b.y);
		Point subBA = new Point(b.x - a.x, b.y - a.y);
		Point subOA = new Point(o.x - a.x, o.y - a.y);
		Point subOB = new Point(o.x - b.x, o.y - b.y);
		if (dot(subBA, subOA) < EPS)
			return Math.hypot(subOA.x, subOA.y);
		else if (dot(subAB, subOB) < EPS)
			return Math.hypot(subOB.x, subOB.y);
		else
			return crossProduct(subBA, subOA) / Math.hypot(subBA.x, subBA.y);
	}

	// 外積
	double crossProduct(Point a, Point b) {
		return a.x * b.y - a.y * b.x;
	}

	// 内積
	double dot(Point a, Point b) {
		return a.x * b.x + a.y * b.y;
	}

	double norm(Point a) {
		return Math.sqrt(a.x * a.x + a.y * a.y);
	}

	double triangleArea(Point p1, Point p2, Point p3) {
		return Math.abs((p3.y - p1.y) * (p2.x - p1.x) - (p2.y - p1.y) * (p3.x - p1.x)) / 2;
	}

	public static void main(String[] args) {
		new MainD().run();
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	void debug2(char[][] array) {
		for (int i = 0; i < array.length; i++) {
			for (int j = 0; j < array[i].length; j++) {
				System.out.print(array[i][j]);
			}
			System.out.println();
		}
	}

	boolean inner(int h, int w, int limH, int limW) {
		return 0 <= h && h < limH && 0 <= w && w < limW;
	}

	void swap(int[] x, int a, int b) {
		int tmp = x[a];
		x[a] = x[b];
		x[b] = tmp;
	}

	// find minimum i (k <= a[i])
	int lower_bound(int a[], int k) {
		int l = -1;
		int r = a.length;
		while (r - l > 1) {
			int mid = (l + r) / 2;
			if (k <= a[mid])
				r = mid;
			else
				l = mid;
		}
		// r = l + 1
		return r;
	}

	// find minimum i (k < a[i])
	int upper_bound(int a[], int k) {
		int l = -1;
		int r = a.length;
		while (r - l > 1) {
			int mid = (l + r) / 2;
			if (k < a[mid])
				r = mid;
			else
				l = mid;
		}
		// r = l + 1
		return r;
	}

	long gcd(long a, long b) {
		return a % b == 0 ? b : gcd(b, a % b);
	}

	long lcm(long a, long b) {
		return a * b / gcd(a, b);
	}

	boolean palindrome(String s) {
		for (int i = 0; i < s.length() / 2; i++) {
			if (s.charAt(i) != s.charAt(s.length() - 1 - i)) {
				return false;
			}
		}
		return true;
	}

	class MyScanner {
		int nextInt() {
			try {
				int c = System.in.read();
				while (c != '-' && (c < '0' || '9' < c))
					c = System.in.read();
				if (c == '-')
					return -nextInt();
				int res = 0;
				do {
					res *= 10;
					res += c - '0';
					c = System.in.read();
				} while ('0' <= c && c <= '9');
				return res;
			} catch (Exception e) {
				return -1;
			}
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		String next() {
			try {
				StringBuilder res = new StringBuilder("");
				int c = System.in.read();
				while (Character.isWhitespace(c))
					c = System.in.read();
				do {
					res.append((char) c);
				} while (!Character.isWhitespace(c = System.in.read()));
				return res.toString();
			} catch (Exception e) {
				return null;
			}
		}

		int[] nextIntArray(int n) {
			int[] in = new int[n];
			for (int i = 0; i < n; i++) {
				in[i] = nextInt();
			}
			return in;
		}

		int[][] nextInt2dArray(int n, int m) {
			int[][] in = new int[n][m];
			for (int i = 0; i < n; i++) {
				in[i] = nextIntArray(m);
			}
			return in;
		}

		double[] nextDoubleArray(int n) {
			double[] in = new double[n];
			for (int i = 0; i < n; i++) {
				in[i] = nextDouble();
			}
			return in;
		}

		long[] nextLongArray(int n) {
			long[] in = new long[n];
			for (int i = 0; i < n; i++) {
				in[i] = nextLong();
			}
			return in;
		}

		char[][] nextCharField(int n, int m) {
			char[][] in = new char[n][m];
			for (int i = 0; i < n; i++) {
				String s = sc.next();
				for (int j = 0; j < m; j++) {
					in[i][j] = s.charAt(j);
				}
			}
			return in;
		}
	}
}