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.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;


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

	static class Scanner 
	{
		StringTokenizer st;
		BufferedReader br;

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

		public String next() throws IOException 
		{
			while (st == null || !st.hasMoreTokens()) 
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {return Integer.parseInt(next());}
		
		public long nextLong() throws IOException {return Long.parseLong(next());}

		public String nextLine() throws IOException {return br.readLine();}
		
		public double nextDouble() throws IOException
		{
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if(x.charAt(0) == '-')
			{
				neg = true;
				start++;
			}
			for(int i = start; i < x.length(); i++)
				if(x.charAt(i) == '.')
				{
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				}
				else
				{
					sb.append(x.charAt(i));
					if(dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg?-1:1);
		}
		
		public boolean ready() throws IOException {return br.ready();}


	}
}