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 CF340D
{


    PrintWriter out;
    int i = 0, j = 0;


    void solve()
    {
        /**************START**************/
        FastScanner in = new FastScanner(System.in);
        int x1 = in.nextInt(), y1 = in.nextInt(),x2 = in.nextInt(), y2 = in.nextInt(),x3 = in.nextInt(), y3 = in.nextInt();
        if ((x1 == x2 && x1 == x3) || (y1 == y2 && y2 == y3))
        {
            System.out.println("1");
            return;
        }
        /*
        if ((x1 == x2 && y2 == y3) || (y1 == y2 && x2 == x3) || (x1 == x3 && y3 == y2) || (y1 == y3 && x3 == x2) || (x2 == x1 && y1 == y3) || (y2 == y1 && x1 == x3))
        {
            System.out.println("2");
            return;
        }
        */

        if (x1 == x2)
        {
            if (y3 <= Math.min(y1,y2) || y3 >= Math.max(y1,y2))
            {
                System.out.println("2");
                return;
            }
        }
        if (y1 == y2)
        {
            if (x3 <= Math.min(x1,x2) || x3 >= Math.max(x1,x2))
            {
                System.out.println("2");
                return;
            }
        }

        if (x1 == x3)
        {
            if (y2 <= Math.min(y1,y3) || y2 >= Math.max(y1,y3))
            {
                System.out.println("2");
                return;
            }
        }
        if (y1 == y3)
        {
            if (x2 <= Math.min(x1,x3) || x2 >= Math.max(x1,x3))
            {
                System.out.println("2");
                return;
            }
        }

        if (x2 == x3)
        {
            if (y1 <= Math.min(y2,y3) || y1 >= Math.max(y2,y3))
            {
                System.out.println("2");
                return;
            }
        }
        if (y2 == y3)
        {
            if (x1 <= Math.min(x2,x3) || x1 >= Math.max(x2,x3))
            {
                System.out.println("2");
                return;
            }
        }



        System.out.println("3");


        /***************END***************/
    }

    public static void main(String[] args)
    {
        new CF340D().runIO();
    }

    void runIO()
    {

        out = new PrintWriter(System.out);

        solve();

        out.close();
    }

    void printGrid(char[][] g)
    {
        for (int a = 0; a < g.length; a++)
        {
            out.println(new String(g[a]));
        }
    }

    class FastScanner
    {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(File f)
        {
            try
            {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e)
            {
                e.printStackTrace();
            }
        }

        public FastScanner(InputStream f)
        {
            br = new BufferedReader(new InputStreamReader(f));
        }

        String next()
        {
            while (st == null || !st.hasMoreTokens())
            {
                String s = null;
                try
                {
                    s = br.readLine();
                } catch (IOException e)
                {
                    e.printStackTrace();
                }
                if (s == null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        //This will empty out the current line (if non-empty) and return the next line down. If the next line is empty, will return the empty string.
        String nextLine()
        {
            st = null;
            String s = null;
            try
            {
                s = br.readLine();
            } catch (IOException e)
            {
                e.printStackTrace();
            }
            return s;
        }

        boolean hasMoreTokens()
        {
            while (st == null || !st.hasMoreTokens())
            {
                String s = null;
                try
                {
                    s = br.readLine();
                } catch (IOException e)
                {
                    e.printStackTrace();
                }
                if (s == null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }


        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }
    }
}
