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.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Arena {

    public static void main(String[] args) {
        MyScanner input = new MyScanner();
        PrintWriter output = new PrintWriter(new BufferedOutputStream(System.out));

        Point first = new Point(input.nextLong(), input.nextLong());
        Point second = new Point(input.nextLong(), input.nextLong());
        Point third = new Point(input.nextLong(), input.nextLong());

        output.println(getResult(first, second, third));
        output.close();
    }

    private static int getResult(Point first, Point second, Point third) {
        if (first.a == second.a && second.a == third.a
                || first.b == second.b && second.b == third.b) {
            return 1;
        }

        if (first.a == second.a && (third.b >= first.b && third.b >= second.b || third.b <= first.b && third.b <= second.b)) {
            return 2;
        }
        if (first.a == third.a && (second.b >= first.b && second.b >= third.b || second.b <= first.b && second.b <= third.b)) {
            return 2;
        }
        if (second.a == third.a && (first.b >= second.b && first.b >= third.b || first.b <= second.b && first.b <= third.b)) {
            return 2;
        }

        if (first.b == second.b && (third.a >= first.a && third.a >= second.a || third.a <= first.a && third.a <= second.a)) {
            return 2;
        }
        if (first.b == third.b && (second.a >= first.a && second.a >= third.a || second.a <= first.a && second.a <= third.a)) {
            return 2;
        }
        if (second.b == third.b && (first.a >= second.a && first.a >= third.a || first.a <= second.a && first.a <= third.a)) {
            return 2;
        }

        return 3;
    }

    private static void swap(Point p1, Point p2) {
        Point temp = p1;
        p1 = p2;
        p2 = temp;
    }

    private static class Point {
        private long a;
        private long b;

        public Point(long a, long b) {
            this.a = a;
            this.b = b;
        }
    }

    private static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

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

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

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

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

        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}
