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.*;
import java.io.*;
public class Main {
    static class Scan {
        private byte[] buf=new byte[1024];
        private int index;
        private InputStream in;
        private int total;
        public Scan()
        {
            in=System.in;
        }
        public int scan()throws IOException
        {
            if(total<0)
            throw new InputMismatchException();
            if(index>=total)
            {
                index=0;
                total=in.read(buf);
                if(total<=0)
                return -1;
            }
            return buf[index++];
        }
        public int scanInt()throws IOException
        {
            int integer=0;
            int n=scan();
            while(isWhiteSpace(n))
            n=scan();
            int neg=1;
            if(n=='-')
            {
                neg=-1;
                n=scan();
            }
            while(!isWhiteSpace(n))
            {
                if(n>='0'&&n<='9')
                {
                    integer*=10;
                    integer+=n-'0';
                    n=scan();
                }
                else throw new InputMismatchException();
            }
            return neg*integer;
        }
        public double scanDouble()throws IOException
        {
            double doub=0;
            int n=scan();
            while(isWhiteSpace(n))
            n=scan();
            int neg=1;
            if(n=='-')
            {
                neg=-1;
                n=scan();
            }
            while(!isWhiteSpace(n)&&n!='.')
            {
                if(n>='0'&&n<='9')
                {
                    doub*=10;
                    doub+=n-'0';
                    n=scan();
                }
                else throw new InputMismatchException();
            }
            if(n=='.')
            {
                n=scan();
                double temp=1;
                while(!isWhiteSpace(n))
                {
                    if(n>='0'&&n<='9')
                    {
                        temp/=10;
                        doub+=(n-'0')*temp;
                        n=scan();
                    }
                    else throw new InputMismatchException();
                }
            }
            return doub*neg;
        }
        public String scanString()throws IOException
        {
            StringBuilder sb=new StringBuilder();
            int n=scan();
            while(isWhiteSpace(n))
            n=scan();
            while(!isWhiteSpace(n))
            {
                sb.append((char)n);
                n=scan();
            }
            return sb.toString();
        }
        private boolean isWhiteSpace(int n)
        {
            if(n==' '||n=='\n'||n=='\r'||n=='\t'||n==-1)
            return true;
            return false;
        }
    }
    public static void main(String args[]) throws IOException {
        Scan input=new Scan();
        int x1=input.scanInt();
        int y1=input.scanInt();
        int x2=input.scanInt();
        int y2=input.scanInt();
        int x3=input.scanInt();
        int y3=input.scanInt();
        
        if(x1==x2 && x2==x3) {
            System.out.println(1);
            return;
        }
        if(y1==y2 && y2==y3) {
            System.out.println(1);
            return;
        }
        if(x1==x2) {
            if(y1<y2 && (y3<=y1 || y3>=y2)) {
                System.out.println(2);
                return;
            }
            else if(y1>=y2 && (y3>=y1 || y3<=y2)){
                System.out.println(2);
                return;
            }
        }
        if(x1==x3) {
            if(y1<y3 && (y2<=y1 || y2>=y3)) {
                System.out.println(2);
                return;
            }
            else if(y1>=y3 && (y2>=y1 || y2<=y3)){
                System.out.println(2);
                return;
            }
        }
        if(x2==x3) {
            if(y2<y3 && (y1<=y2 || y1>=y3)) {
                System.out.println(2);
                return;
            }
            else if(y2>=y3 && (y1>=y2 || y1<=y3)){
                System.out.println(2);
                return;
            }
        }
        
        if(y1==y2) {
            if(x1<x2 && (x3<=x1 || x3>=x2)) {
                System.out.println(2);
                return;
            }
            else if(x1>=x2 && (x3>=x1 || x3<=x2)){
                System.out.println(2);
                return;
            }
        }
        if(y1==y3) {
            if(x1<x3 && (x2<=x1 || x2>=x3)) {
                System.out.println(2);
                return;
            }
            else if(x1>=x3 && (x2>=x1 || x2<=x3)){
                System.out.println(2);
                return;
            }
        }
        if(y2==y3) {
            if(x2<x3 && (x1<=x2 || x1>=x3)) {
                System.out.println(2);
                return;
            }
            else if(x2>=x3 && (x1>=x2 || x1<=x3)){
                System.out.println(2);
                return;
            }
        }
        System.out.println(3);
    }
}
