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.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner cin = new Scanner(System.in);
		int x1,y1,x2,y2,x3,y3;
		x1 = cin.nextInt();
		y1 = cin.nextInt();
		x2 = cin.nextInt();
		y2 = cin.nextInt();
		x3 = cin.nextInt();
		y3 = cin.nextInt();
		
		if(x1==x2&&x2==x3)
			System.out.println("1");
		else
		{
			if(y1==y2&&y2==y3)
				System.out.println("1");
			else
			{
				if(y1==y2)
				{
					int minx=x1<x2?x1:x2;
					int maxx=x1<x2?x2:x1;
					if(x3<=minx||x3>=maxx)
						System.out.println("2");
					else
						System.out.println("3");
				}
				else
				{
					if(y3==y2)
					{
						int minx=x3<x2?x3:x2;
						int maxx=x3<x2?x2:x3;
						if(x1<=minx||x1>=maxx)
							System.out.println("2");
						else
							System.out.println("3");
					}
					else
					{
						if(y1==y3)
						{
							int minx=x1<x3?x1:x3;
							int maxx=x1<x3?x3:x1;
							if(x2<=minx||x2>=maxx)
								System.out.println("2");
							else
								System.out.println("3");
						}
						else
						{
							if(x1==x2)
							{
								int miny=y1<y2?y1:y2;
								int maxy=y1<y2?y2:y1;
								if(y3<=miny||y3>=maxy)
									System.out.println("2");
								else
									System.out.println("3");
							}
							else
							{
								if(x3==x2)
								{
									int miny=y3<y2?y3:y2;
									int maxy=y3<y2?y2:y3;
									if(y1<=miny||y1>=maxy)
										System.out.println("2");
									else
										System.out.println("3");
								}
								else
								{
									if(x1==x3)
									{
										int miny=y1<y3?y1:y3;
										int maxy=y1<y3?y3:y1;
										if(y2<=miny||y2>=maxy)
											System.out.println("2");
										else
											System.out.println("3");
									}
									else
										System.out.println("3");
								}
							}
						}
					}
				}
			}
		}
	}
}

		      			 	   			 		 	 		 		