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.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class D {

	static boolean sr(long x1, long y1, long x2, long y2) {
		return x1 == x2;
	}

	static boolean sr(int a, int b) {
		return sr(p[a][0], p[a][1], p[b][0], p[b][1]);
	}

	static boolean sc(long x1, long y1, long x2, long y2) {
		return y1 == y2;
	}

	static boolean sc(int a, int b) {
		return sc(p[a][0], p[a][1], p[b][0], p[b][1]);
	}

	static boolean b(long a, long b, long x) {
		if (b < a)
			return b(b, a, x);
		return x > a && x < b;
	}

	static long[][] p;

	public static void main(String[] args) throws IOException {
		File inputFile = new File("entradaD");
		if (inputFile.exists())
			System.setIn(new FileInputStream(inputFile));
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder out = new StringBuilder();
		String line = "";
		while ((line = in.readLine()) != null) {
			p = new long[3][];
			p[0] = readLongs(line);
			for (int i = 1; i < p.length; i++)
				p[i] = readLongs(in.readLine());
			long best = Long.MAX_VALUE, cur = 0;
			for (int a = 0; a < 3; a++)
				for (int b = 0; b < 3; b++)
					for (int c = 0; a != b && c < 3; c++) {
						if (a != c && b != c) {
							cur = 3;
							if (sr(a, b)) {
								if (sr(b, c))
									cur = Math.min(cur, 1);
								else if (b(p[a][1], p[b][1], p[c][1]))
									cur = Math.min(cur, 3);
								else
									cur = Math.min(cur, 2);
							}
							if (sc(a, b)) {
								if (sc(b, c))
									cur = Math.min(cur, 1);
								else if (b(p[a][0], p[b][0], p[c][0]))
									cur = Math.min(cur, 3);
								else
									cur = Math.min(cur, 2);
							}
							best = Math.min(best, cur);
						}
					}
			out.append(best + "\n");
		}
		System.out.print(out);
	}

	static int[] readInts(String line) {
		StringTokenizer st = new StringTokenizer(line.trim());
		int a[] = new int[st.countTokens()], index = 0;
		while (st.hasMoreTokens())
			a[index++] = Integer.parseInt(st.nextToken());
		return a;
	}

	static long[] readLongs(String line) {
		StringTokenizer st = new StringTokenizer(line.trim());
		long a[] = new long[st.countTokens()];
		int index = 0;
		while (st.hasMoreTokens())
			a[index++] = Long.parseLong(st.nextToken());
		return a;
	}

	static double[] readDoubles(String line) {
		StringTokenizer st = new StringTokenizer(line.trim());
		double a[] = new double[st.countTokens()];
		int index = 0;
		while (st.hasMoreTokens())
			a[index++] = Double.parseDouble(st.nextToken());
		return a;
	}
}
