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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.*;

public class D {
    public static void main(String[] args) {
//        Scanner sc = new Scanner(System.in);
        FastScanner sc = new FastScanner();

//        long[] x = new long[3];
//        long[] y = new long[3];
        Point[] points = new Point[3];
        Point[] points2 = new Point[3];
        Set<Long> xs = new HashSet<>();
        Set<Long> ys = new HashSet<>();
        for (int i = 0; i < 3; i++) {
            long x = sc.nextLong();
            long y = sc.nextLong();
            Point p = new Point(x, y);
            points[i] = p;
            points2[i] = p;
            xs.add(x);
            ys.add(y);
        }
        Arrays.sort(points);
        Arrays.sort(points2, new Comparator<Point>() {
            @Override
            public int compare(Point o1, Point o2) {
                return Long.compare(o1.x, o2.x);
            }
        });

        int ans = 3;
        if (xs.size() == 1 || ys.size() == 1) {
            ans = 1;
        } else if (points[0].x == points[1].x || points[1].x == points[2].x
                || points2[0].y == points2[1].y || points2[1].y == points2[2].y) {
            ans = 2;
//        } else if (points[0].x == points[2].x
//                && (points[0].y == points[1].y || points[2].y == points[1].y)) {
//            ans = 2;
        } else if (xs.size() == 2 && ys.size() == 2) {
            ans = 2;
        }  else {
            ans = 3;
        }
//        if (xs.size() == 1 && ys.size() == 1) {
//            ans = 0;
//        } else if (xs.size() == 1 || ys.size() == 1) {
//            ans = 1;
//        } else if (xs.size() == 2 || ys.size() == 2) {
//            ans = 2;
//        } else {
//            ans = 3;
//        }

        System.out.println(ans);
    }

    static class Point implements Comparable<Point> {
        final long x, y;

        @Override
        public int compareTo(Point o) {
            return Long.compare(y, o.y);
        }

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

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(Reader in) {
            br = new BufferedReader(in);
        }

        public FastScanner() {
            this(new InputStreamReader(System.in));
        }

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

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

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

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

        // Slightly different from java.util.Scanner.nextLine(),
        // which returns any remaining characters in current line,
        // if any.
        String readNextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        int[] readIntArray(int n) {
            int[] a = new int[n];
            for (int idx = 0; idx < n; idx++) {
                a[idx] = nextInt();
            }
            return a;
        }
    }
}
