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.util.*;
import java.io.*;
import java.math.*;

public class Main {

	BufferedReader in;
	StringTokenizer str = null;
	PrintWriter out;
	
	private String next() throws Exception{
		while (str == null || !str.hasMoreElements())
			str = new StringTokenizer(in.readLine());
		return str.nextToken();
	}
	
	private int nextInt() throws Exception{
		return Integer.parseInt(next());
	}
	
	private long nextLong() throws Exception{
		return Long.parseLong(next());
	}
	
	private double nextDouble() throws Exception{
		return Double.parseDouble(next());
	}

	final long oo = Long.MAX_VALUE;
	
	public void run() throws Exception{
		in =  new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		int []a = new int[3];
		for(int i = 1; i < 3; ++i) a[i] = i;
		int []x = new int[3];
		int []y = new int[3];
		for(int i = 0; i < 3; ++i) {
			x[i] = nextInt();
			y[i] = nextInt();
		}

		int ret = 3;
		while(a.length > 0) {
			ret = Math.min(ret, calc(x[a[0]], y[a[0]], x[a[1]], y[a[1]], x[a[2]], y[a[2]]));
			a = nextPermutation(a);
		}

		out.println(ret);
		out.close();
	}

	private int calc(int x1, int y1, int x2, int y2, int x3, int y3) {
		if (x1 == x2 && x2 == x3) return 1;
		if (y1 == y2 && y2 == y3) return 1;
		if (x1 == x2) {
			if (y3 >= Math.max(y1, y2) || y3 <= Math.min(y1, y2)) return 2;
		}
		if (y1 == y2) {
			if (x3 >= Math.max(x1, x2) || x3 <= Math.min(x1, x2)) return 2;
		}
		if (x1 == x3) {
			if (y2 >= Math.max(y1, y3) || y2 <= Math.min(y1, y3)) return 2;
		}
		if (y1 == y3) {
			if (x2 >= Math.max(x1, x3) || x2 <= Math.min(x1, x3)) return 2;
		}
		return 3;
	}

	private int[] nextPermutation(int []a) {
		int n = a.length;
		int k = n - 2;
		while(a[k + 1] < a[k]) {
			--k;
			if (k < 0) {
				return new int[]{};
			}
		}
		int idx = -1;
		for(int i = k + 1; i < n; ++i) {
			if (a[k] < a[i] && (idx == -1 || a[idx] > a[i])) {
				idx = i;
			}
		}
		int tmp = a[idx];
		a[idx] = a[k];
		a[k] = tmp;

		for(int i = k + 1, j = n - 1; i < j; ++i, --j) {
			tmp = a[i];
			a[i] = a[j];
			a[j] = tmp;
		}

		return a;
	}

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