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.*;
import java.util.*;
public class q1 {
	static int fuck1,fuck11,fuck2,fuck22,fuck3,fuck33;
	static int ans=0;
	static void go1()
	{
		
		
		if(fuck3>fuck1&&fuck3<fuck2)
            ans=3;
        else if(fuck3<fuck1&&fuck3>fuck2)
            ans=3;
        else
            ans=2;
	}
	static void go2()
	{
		if(fuck1>fuck3&&fuck1<fuck2)
            ans=3;
        else if(fuck1<fuck3&&fuck1>fuck2)
            ans=3;
        else
            ans=2;
	}
	static void go3()
	{
		  if(fuck2>fuck1&&fuck2<fuck3)
              ans=3;
          else if(fuck2<fuck1&&fuck2>fuck3)
              ans=3;
          else
              ans=2;
	}
	static void go4()
	{
		 if(fuck33>fuck11&&fuck33<fuck22)
             ans=3;
         else if(fuck33<fuck11&&fuck33>fuck22)
             ans=3;
         else
             ans=2;
	}
	static void go5()
	{
		if(fuck11>fuck33&&fuck11<fuck22)
            ans=3;
        else if(fuck11<fuck33&&fuck11>fuck22)
            ans=3;
        else
            ans=2;
	}
	static void go6()
	{
		   if(fuck22>fuck11&&fuck22<fuck33)
               ans=3;
           else if(fuck22<fuck11&&fuck22>fuck33)
               ans=3;
           else
               ans=2;
	}
	public static void main(String[] args) throws Exception
	{
		InputReader in=new InputReader(System.in);
		PrintWriter pw=new PrintWriter(System.out);

	    
         ans=0;
        fuck1=in.nextInt();
        fuck11=in.nextInt();
        fuck2=in.nextInt();
        fuck22=in.nextInt();
        fuck3=in.nextInt();
        fuck33=in.nextInt();
        if(fuck1==fuck2&&fuck1==fuck3)
        {
            ans=1;
        }
        else if(fuck11==fuck22&&fuck11==fuck33)
        {
            ans=1;
        }
        else if(fuck11==fuck22)
        {
            go1();
        }
        else if(fuck33==fuck22)
        {
            go2();
        }
        else if(fuck11==fuck33)
        {
          go3();
        }
        else if(fuck1==fuck2)
        {
           go4();
        }
        else if(fuck3==fuck2)
        {
            go5();
        }
        else if(fuck1==fuck3)
        {
         go6();
        }
        else
            ans=3;
           pw.println(ans);             
       
                    
        
        pw.close();
		//pw.close();
	}
	
	static class pair
	{
		long a,b;
		public pair(long a,long b)
		{
			this.a=a;
			this.b=b;
		}
	}
	
	
	
	
	
	
	
	 static class InputReader {

		private InputStream stream;
		private byte[] buf = new byte[8192];
		private int curChar;
		private int snumChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int snext() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}

			int res = 0;

			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));

			return res * sgn;
		}
		
		public long nextLong() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}

			long res = 0;

			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));

			return res * sgn;
		}
		
		public String readString() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = snext();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}

}
