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;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class ProblemD {

	public static void main(String[] args) {
		InputReader in = new InputReader();
		PrintWriter out = new PrintWriter(System.out);

		new ProblemD().solve(in, out);

		out.close();
	}

	public void solve(InputReader in, PrintWriter out) {
		int[] x = new int[3];
		int[] y = new int[3];

		x[0] = in.nextInt();
		y[0] = in.nextInt();

		x[1] = in.nextInt();
		y[1] = in.nextInt();

		x[2] = in.nextInt();
		y[2] = in.nextInt();

		// case 1 - all three are parallel
		if (x[0] == x[1] && x[0] == x[2]) {
			out.println(1);

			return;
		}

		if (y[0] == y[1] && y[0] == y[2]) {
			out.println(1);

			return;
		}

		// case 2 - two points are parallel
		for (int i = 0; i < 3; i++) {
			for (int j = i + 1; j < 3; j++) {

				// parallel X case
				boolean parallelX = isParallelX(y[i], y[j]);

				if (parallelX) {
					int k = remainingPoint(i, j);

					if ((x[k] > x[i] && x[k] < x[j]) || (x[k] < x[i] && x[k] > x[j])) {
						out.println(3);

						return;
					} else {
						out.println(2);

						return;
					}
				}

				// parallel Y case
				boolean parallelY = isParallelY(x[i], x[j]);

				if (parallelY) {
					int k = remainingPoint(i, j);

					if ((y[k] > y[i] && y[k] < y[j]) || (y[k] < y[i] && y[k] > y[j])) {
						out.println(3);

						return;
					} else {
						out.println(2);

						return;
					}
				}
			}
		}

		// case 3 - no parallel points
		out.println(3);
	}

	private static boolean isParallelX(int ya, int yb) {
		return ya == yb;
	}

	private static boolean isParallelY(int xa, int xb) {
		return xa == xb;
	}

	private static int remainingPoint(int i, int j) {
		boolean[] b = new boolean[3];

		b[i] = true;
		b[j] = true;

		for (int k = 0; k < 3; k++) {
			if (!b[k]) {
				return k;
			}
		}

		return -1;
	}

	static class InputReader {
		public BufferedReader br;
		public StringTokenizer st;

		public InputReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

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

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

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
}
