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.Scanner;

/**
 * Created by Kirill Antonov on 19.02.2016.
 */

public class codeforces {
    static class Point {
        long x, y;

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

    static class Line {
        long a, b, c;
        Point p, q;

        public Line(Point a, Point b) {
            this.p = a;
            this.q = b;
            this.a = b.y - a.y;
            this.b = a.x - b.x;
            this.c = a.y * b.x - a.x * b.y;
        }
    }

    public static boolean compr(Line l, Point p) {
        if (l.a * p.x + l.b * p.y + l.c == 0) return true;
        return false;
    }

    public static boolean perp(Line l1, Line l2) {
        long n1 = l1.p.x - l1.q.x, m1 = l1.p.y - l1.q.y, n2 = l2.p.x - l2.q.x, m2 = l2.p.y - l2.q.y;
        if (n1 * n2 + m1 * m2 == 0) {
            return true;
        }
        return false;
    }

    public static Point a;
    public static Point b;
    public static Point c;

    public static boolean check(Line l, int i, boolean ox) {
        if (i == 0) return checker(c, l, ox);
        if (i == 1) return checker(b, l, ox);
        if (i == 2) return checker(a, l, ox);
        return false;
    }

    public static boolean checker(Point k, Line l, boolean ox) {
        long upy = Math.max(l.q.y, l.p.y), upx = Math.max(l.p.x, l.q.x), downy = Math.min(l.q.y, l.p.y), downx = Math.min(l.q.x, l.p.x);
        if (ox) {
            if (downy < k.y && k.y < upy) return false;
            else return true;
        } else {
            if (downx < k.x && k.x < upx) return false;
            else return true;
        }

    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        a = new Point(in.nextInt(), in.nextInt());
        b = new Point(in.nextInt(), in.nextInt());
        c = new Point(in.nextInt(), in.nextInt());
        Line oy = new Line(new Point(0, 0), new Point(0, 1)), ox = new Line(new Point(0, 0), new Point(1, 0));
        Line ab = new Line(a, b), bc = new Line(b, c), ac = new Line(a, c);
        Line[] lines = {ab, ac, bc};
        int ans = 0;
        if ((perp(ab, ox) && perp(ac, ox)) || (perp(ab, oy) && perp(ac, oy))) ans = 1;
        else {
            for (int i = 0; i < 3; i++) {
                if (perp(lines[i], ox)) {
                    if (check(lines[i], i, true)) ans = 2;
                    break;
                }
                if (perp(lines[i], oy)) {
                    if (check(lines[i], i, false)) ans = 2;
                    break;
                }
            }
            if (ans == 0) ans = 3;
        }
        System.out.print(ans);
    }
}