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.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.Iterator;
 

public class Temp
{
    public static void main(String[] args) throws Exception
    {
        InputReader in = new InputReader(System.in);
        OutputWriter out = new OutputWriter(System.out);
        double x1 = in.readDouble();
        double y1 =in.readDouble();
        double x2 = in.readDouble();
        double y2 = in.readDouble();
        double x3 = in.readDouble();
        double y3 = in.readDouble();
        HashSet<Double> hs = new HashSet();
        hs.add(x1); hs.add(x2); hs.add(x3);
        if( hs.size()==1 )
        {
       		out.println(1);
        }
        else if( hs.size()==2 )
        {
        	double yy1,yy2,yy3,xx1,xx2;
        	Iterator<Double> it = hs.iterator();
        	xx1 = it.next();
        	xx2 = it.next();
        	if( ( x1==xx1 && x2==xx1 ) || ( x3==xx1 && x2==xx1 ) || ( x1==xx1 && x3==xx1 )   )
        	{
        		if( x1==xx1 )
        		{
        			yy1=y1;
        			if( x2==xx1 )
        			{
        				yy2=y3;
        				yy3=y2;
        			}
        			else
        			{
        				yy2=y2;
        				yy3=y3;
        			}
        		}
        		else
        		{
        			yy1=y2;
        			yy2=y1;
        			yy3=y3;
        		}
        	}
        	else
        	{
        		if( x1==xx2 )
        		{
        			yy1=y1;
        			if( x2==xx2 )
        			{
        				yy2=y3;
        				yy3=y2;
        			}
        			else
        			{
        				yy2=y2;
        				yy3=y3;
        			}
        		}
        		else
        		{
        			yy1=y2;
        			yy2=y1;
        			yy3=y3;
        		}
        	}
//        	System.out.println(yy1+" "+yy2+" "+yy3);
        	if( (yy1<yy2 && yy2<yy3) || (yy1>yy2 && yy2>yy3) )
        	{
        		out.println(3);
        	}
        	else
        		out.println(2);
        }
        else
        {
        	hs=new HashSet();
        	hs.add(y1); hs.add(y2); hs.add(y3);
        	if( hs.size()==1 )
        	{
            	out.println(1);
        	}
            else if( hs.size()==2 )
            {
            	double yy1,yy2,xx1,xx2,xx3;
            	Iterator<Double> it = hs.iterator();
            	yy1 = it.next();
            	yy2 = it.next();
            	if( ( y1==yy1 && y2==yy1 ) || ( y3==yy1 && y2==yy1 ) || ( y1==yy1 && y3==y1 )   )
            	{
            		if( y1==yy1 )
            		{
            			xx1=x1;
            			if( y2==yy1 )
            			{
            				xx2=x3;
            				xx3=x2;
            			}
            			else
            			{
            				xx2=x2;
            				xx3=x3;
            			}
            		}
            		else
            		{
            			xx1=x2;
            			xx2=x1;
            			xx3=x3;
            		}
            	}
            	else
            	{
            		if( y1==yy2 )
            		{
            			xx1=x1;
            			if( y2==yy2 )
            			{
            				xx2=x3;
            				xx3=x2;
            			}
            			else
            			{
            				xx2=x2;
            				xx3=x3;
            			}
            		}
            		else
            		{
            			xx1=x2;
            			xx2=x1;
            			xx3=x3;
            		}
            	}
            	if( (xx1<xx2 && xx2<xx3) || (xx1>xx2 && xx2>xx3) )
            	{
            		out.println(3);
            	}
            	else
            		out.println(2);
            }
            else
            	out.println(3);
        }
        out.close();
        
    }
 
    private static class InputReader
    {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
 
        public InputReader(InputStream stream)
        {
            this.stream = stream;
        }
 
        public int read()
        {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars)
            {
                curChar = 0;
                try
                {
                    numChars = stream.read(buf);
                } catch (IOException e)
                {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }
 
        public int readInt()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do
            {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
 
        public String readString()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do
            {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }
        public double readDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, readInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, readInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }
        public long readLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
        public boolean isSpaceChar(int c)
        {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
 
        public String next()
        {
            return readString();
        }
 
        public interface SpaceCharFilter
        {
            public boolean isSpaceChar(int ch);
        }
    }
 
    private static class OutputWriter
    {
        private final PrintWriter writer;
 
        public OutputWriter(OutputStream outputStream)
        {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }
 
        public OutputWriter(Writer writer)
        {
            this.writer = new PrintWriter(writer);
        }
 
        public void print(Object... objects)
        {
            for (int i = 0; i < objects.length; i++)
            {
                if (i != 0)
                    writer.print(' ');
                writer.print(objects[i]);
            }
        }
 
        public void println(Object... objects)
        {
            print(objects);
            writer.println();
        }
 
        public void close()
        {
            writer.close();
        }
 
        public void flush()
        {
            writer.flush();
        }
     }
}