There are three points marked on the coordinate plane. The goal is to make a simple polyline, without self-intersections and self-touches, such that it passes through all these points. Also, the polyline must consist of only segments parallel to the coordinate axes. You are to find the minimum number of segments this polyline may consist of.

Input

Each of the three lines of the input contains two integers. The i-th line contains integers xi and yi ( - 109 ≤ xi, yi ≤ 109) — the coordinates of the i-th point. It is guaranteed that all points are distinct.

Output

Print a single number — the minimum possible number of segments of the polyline.

Examples

Input

1 -1
1 1
1 2


Output

1


Input

-1 -1
-1 3
4 3


Output

2


Input

1 1
2 3
3 2


Output

3

Note

The variant of the polyline in the first sample: <image> The variant of the polyline in the second sample: <image> The variant of the polyline in the third sample: <image>
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Polyline {
	private static final BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

	public void solve() throws IOException {
		int[] a = ia();
		int x1 = a[0];
		int x2 = a[1];
		a = ia();
		int y1 = a[0];
		int y2 = a[1];
		a = ia();
		int z1 = a[0];
		int z2 = a[1];
		
		int min, max;
		if ((x1 == y1 && y1 == z1) || (x2 == y2 && y2 == z2)) System.out.println(1);
		else if (x1 == y1) {
			min = Math.min(x2, y2);
			max = Math.max(x2, y2);
			if (z2 > min && z2 < max) System.out.println(3);
			else System.out.println(2);
		}
		else if (x1 == z1) {
			min = Math.min(x2, z2);
			max = Math.max(x2, z2);
			if (y2 > min && y2 < max) System.out.println(3);
			else System.out.println(2);
		}
		else if (z1 == y1) {
			min = Math.min(z2, y2);
			max = Math.max(z2, y2);
			if (x2 > min && x2 < max) System.out.println(3);
			else System.out.println(2);
		}
		// symmetric
		else if (x2 == y2) {
			min = Math.min(x1, y1);
			max = Math.max(x1, y1);
			if (z1 > min && z1 < max) System.out.println(3);
			else System.out.println(2);
		}
		else if (x2 == z2) {
			min = Math.min(x1, z1);
			max = Math.max(x1, z1);
			if (y1 > min && y1 < max) System.out.println(3);
			else System.out.println(2);
		}
		else if (z2 == y2) {
			min = Math.min(z1, y1);
			max = Math.max(z1, y1);
			if (x1 > min && x1 < max) System.out.println(3);
			else System.out.println(2);
		}
		else {
			System.out.println(3);
		}
	}

	public static void main(String[] args) throws IOException {
		new Polyline().solve();
	}
	
	/*
	 * INPUT and OUTPUT
	 */
	
	static <T> void p(T s) {
		System.out.println(s);
	}
	
	static <T> void pa(T[] a) {
		String r = "";
		for (T e : a) r += e + " ";
		System.out.println(r.substring(0, r.length() - 1));
	}
	
	static int i() throws IOException {
		return Integer.parseInt(in.readLine());
	}
	
	static int[] ia() throws IOException {
		String[] s = in.readLine().split(" ");
		int[] r = new int[s.length];
		for (int i = 0; i < s.length; i++) r[i] = Integer.parseInt(s[i]);
		return r;
	}
	
	static long l() throws IOException {
		return Long.parseLong(in.readLine());
	}
	
	static long[] la() throws IOException {
		String[] s = in.readLine().split(" ");
		long[] r = new long[s.length];
		for (int i = 0; i < s.length; i++) r[i] = Long.parseLong(s[i]);
		return r;
	}
	
	static double d() throws IOException {
		return Double.parseDouble(in.readLine());
	}
	
	static double[] da() throws IOException {
		String[] s = in.readLine().split(" ");
		double[] r = new double[s.length];
		for (int i = 0; i < s.length; i++) r[i] = Double.parseDouble(s[i]);
		return r;
	}
}
