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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Artem Gilmudinov
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            PairInt[] points = new PairInt[3];
            for (int i = 0; i < 3; i++) {
                points[i] = new PairInt(in.readInt(), in.readInt());
            }
            boolean sameX = true;
            for (int i = 0; i < 3; i++) {
                if (points[i].x != points[0].x) {
                    sameX = false;
                }
            }
            boolean sameY = true;
            for (int i = 0; i < 3; i++) {
                if (points[i].y != points[0].y) {
                    sameY = false;
                }
            }
            if (sameX || sameY) {
                out.println(1);
                return;
            }
            int[] cnt = new int[3];
            for (int i = 0; i < 3; i++) {
                for (int j = 0; j < 3; j++) {
                    if (i == j) {
                        continue;
                    }
                    if (points[i].x == points[j].x || points[i].y == points[j].y) {
                        ++cnt[i];
                    }
                }
            }
            int total = 0;
            for (int i = 0; i < 3; i++) {
                if (cnt[i] != 0) {
                    ++total;
                }
            }
            if (total == 3) {
                out.println(2);
                return;
            }
            if (total == 0) {
                out.println(3);
                return;
            }
            PairInt f, s, t;
            f = s = t = null;
            boolean[] used = new boolean[3];
            for (int i = 0; i < 3; i++) {
                for (int j = 0; j < 3; j++) {
                    if (i != j) {
                        if (points[i].x == points[j].x || points[i].y == points[j].y) {
                            f = points[i];
                            s = points[j];
                            used[i] = used[j] = true;
                            break;
                        }
                    }
                }
            }
            for (int i = 0; i < 3; i++) {
                if (!used[i]) {
                    t = points[i];
                }
            }
            if (f.x == s.x) {
                int min, max;
                min = Math.min(f.y, s.y);
                max = Math.max(f.y, s.y);
                if (min < t.y && t.y < max) {
                    out.println(3);
                } else {
                    out.println(2);
                }
            } else {
                int min, max;
                min = Math.min(f.x, s.x);
                max = Math.max(f.x, s.x);
                if (min < t.x && t.x < max) {
                    out.println(3);
                } else {
                    out.println(2);
                }
            }
        }

    }

    static class PairInt {
        public int x;
        public int y;

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


        public boolean equals(Object obj) {
            PairInt pairInt = (PairInt) obj;
            return pairInt.x == x && pairInt.y == y;
        }

        public String toString() {
            return x + " " + y;
        }

        public PairInt clone() {
            return new PairInt(x, y);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

