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

public class C {

	public static void main(String[] args) throws IOException{
		
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out); 
		int x1 = sc.nextInt(), y1 = sc.nextInt();
		int x2 = sc.nextInt(), y2 = sc.nextInt();
		int x3 = sc.nextInt(), y3 = sc.nextInt();
		
		if(x1 == x2 && x2 == x3 || y1 == y2 && y2 == y3)
			out.println(1);
		
		else if(x1 == x2)
		{
			int max = Math.max(y1, y2);
			int min = Math.min(y1, y2);
			if(y3 >= max || y3 <= min)
				out.println(2);
			else
				out.println(3);
		}
		
		else if(x1 == x3)
		{
			int max = Math.max(y1, y3);
			int min = Math.min(y1, y3);
			if(y2 >= max || y2 <= min)
				out.println(2);
			else
				out.println(3);
		}
		
		else if(x3 == x2)
		{
			int max = Math.max(y3, y2);
			int min = Math.min(y3, y2);
			if(y1 >= max || y1 <= min)
				out.println(2);
			else
				out.println(3);
		}
		
		else if(y1 == y2)
		{
			int max = Math.max(x1, x2);
			int min = Math.min(x1, x2);
			if(x3 >= max || x3 <= min)
				out.println(2);
			else
				out.println(3);
		}

		else if(y1 == y3)
		{
			int max = Math.max(x1, x3);
			int min = Math.min(x1, x3);
			if(x2 >= max || x2 <= min)
				out.println(2);
			else
				out.println(3);
		}
		
		else if(y3 == y2)
		{
			int max = Math.max(x3, x2);
			int min = Math.min(x3, x2);
			if(x1 >= max || x1 <= min)
				out.println(2);
			else
				out.println(3);
		}
		else
			out.println(3);
		
		out.flush();
	
	}
	
	
	static class Scanner 
	{
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream System)
		{	
			br = new BufferedReader(new InputStreamReader(System));	
		}

		public String next() throws IOException 
		{
			while (st == null || !st.hasMoreTokens()) 
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public String nextLine()throws IOException
		{
			return br.readLine();
		}
		public int nextInt() throws IOException 
		{
			return Integer.parseInt(next());
		}
		public char nextChar()throws IOException
		{
			return next().charAt(0);
		}
		public Long nextLong()throws IOException
		{
			return Long.parseLong(next());
		}
		public boolean ready() throws IOException
		{
			return br.ready();
		}

	}
}

class SegmentTree5 {		// 1-based DS, OOP
	
	int N; 			
	int[] array, sTree, lazy;
	
	SegmentTree5(int[] in)		
	{
		array = in; N = in.length - 1;
		sTree = new int[N<<1];		
		lazy = new int[N<<1];
		//build(1,1,N);
	}
	
	int getRoot()
	{
		return sTree[1];
	}
	
	
	void update_point(int index, int val, boolean byValue)			// O(log n)
	{
		index += N - 1;
		if(byValue)
			sTree[index] = val;
		else
			sTree[index] = Math.max(sTree[index] + val, 0);
		while(index>1)				
		{
			index >>= 1;
			sTree[index] = sTree[index<<1] + sTree[(index<<1) + 1];		
		}
	}
	
	
	void update_range(int i, int j, int val)		// O(log n) 
	{
		update_range(1,1,N,i,j,val);
	}
	
	void update_range(int node, int b, int e, int i, int j, int val)
	{
		if(i > e || j < b)		
			return;
		if(b >= i && e <= j)		
		{
			sTree[node] = Math.max(sTree[node] + (e-b+1)*val, 0) ;			
			lazy[node] += val;				
		}							
		else		
		{
			propagate(node, b, e);
			update_range(node<<1,b,(b+e)/2,i,j,val);
			update_range((node<<1)+1,(b+e)/2+1,e,i,j,val);
			sTree[node] = sTree[node<<1] + sTree[(node<<1)+1];		
		}
		
	}
	void propagate(int node, int b, int e)		
	{
		int mid = (b+e)/2;
		lazy[node<<1] += lazy[node];
		lazy[(node<<1)+1] += lazy[node];
		sTree[node<<1] = Math.max(sTree[node<<1] + (mid-b+1)*lazy[node], 0);		
		sTree[(node<<1)+1] = Math.max(sTree[(node<<1)+1] + (e-mid)*lazy[node], 0);		
		lazy[node] = 0;
	}
	
	int query(int i, int j)
	{
		return query(1,1,N,i,j);
	}
	
	int query(int node, int b, int e, int i, int j)	// O(log n)
	{
		if(i>e || j <b)
			return 0;		
		if(b>= i && e <= j)
			return sTree[node];
		propagate(node, b, e);
		int q1 = query(node<<1,b,(b+e)/2,i,j);
		int q2 = query((node<<1)+1,(b+e)/2+1,e,i,j);
		return q1 + q2;	
				
	}
}