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

    static class Point {
        int x;
        int y;

        public Point(int x, int y) {
            this.x = x;
            this.y = y;
        }
    }

    static boolean isVertical(Point[] points) {
        int x = points[0].x;
        for (Point p : points)
            if (p.x != x) return false;
        return true;
    }

    static boolean isHorizontal(Point[] points) {
        int y = points[0].y;
        for (Point p : points)
            if (p.y != y) return false;
        return true;
    }

    static boolean midy(Point a, Point b, Point c) {
        if ((a.y < b.y && a.y > c.y) || (a.y < c.y && a.y > b.y))
            return true;
        else
            return false;
    }

    static boolean midx(Point a, Point b, Point c) {
        if ((a.x < b.x && a.x > c.x) || (a.x < c.x && a.x > b.x))
            return true;
        else
            return false;
    }

    static void solve(InputReader in, OutputWriter out) {
        Point[] points = new Point[3];
        for (int i = 0; i < 3; i++)
            points[i] = new Point(in.nextInt(), in.nextInt());

        if (isHorizontal(points) || isVertical(points)) {
            out.print(1);
            return;
        }

        if ((points[0].x == points[1].x && !midy(points[2], points[0], points[1]))
                || (points[0].x == points[2].x && !midy(points[1], points[0], points[2]))
                || (points[1].x == points[2].x && !midy(points[0], points[1], points[2]))) {
            out.print(2);
            return;
        }

        if ((points[0].y == points[1].y && !midx(points[2], points[0], points[1]))
                || (points[0].y == points[2].y && !midx(points[1], points[0], points[2]))
                || (points[1].y == points[2].y && !midx(points[0], points[1], points[2]))) {
            out.print(2);
            return;
        }

        out.print(3);
    }

    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);
        OutputWriter out = new OutputWriter(System.out);
        solve(in, out);
        in.close();
        out.close();
    }

    static class InputReader {
        BufferedReader br;
        StringTokenizer st;

        InputReader(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }

        String nextLine() {
            String line = null;
            try {
                line = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return line;
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                String line = nextLine();
                if (line == null) return null;
                st = new StringTokenizer(line);
            }
            return st.nextToken();
        }

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

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

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

        void close() {
            try {
                br.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    static class OutputWriter {
        BufferedWriter bw;

        OutputWriter(OutputStream os) {
            bw = new BufferedWriter(new OutputStreamWriter(os));
        }

        void print(int i) {
            print(Integer.toString(i));
        }

        void println(int i) {
            println(Integer.toString(i));
        }

        void print(long l) {
            print(Long.toString(l));
        }

        void println(long l) {
            println(Long.toString(l));
        }

        void print(double d) {
            print(Double.toString(d));
        }

        void println(double d) {
            println(Double.toString(d));
        }

        void print(boolean b) {
            print(Boolean.toString(b));
        }

        void println(boolean b) {
            println(Boolean.toString(b));
        }

        void print(char c) {
            try {
                bw.write(c);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        void println(char c) {
            println(Character.toString(c));
        }

        void print(String s) {
            try {
                bw.write(s);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        void println(String s) {
            print(s);
            print('\n');
        }

        void close() {
            try {
                bw.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
