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.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;

/**
 * @author khokharnikunj8
 */

public class Main {
    public static void main(String[] args) {
        new Thread(null, new Runnable() {
            public void run() {
                new Main().solve();
            }
        }, "1", 1 << 26).start();
    }

    void solve() {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        ScanReader in = new ScanReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DPolyline solver = new DPolyline();
        solver.solve(1, in, out);
        out.close();
    }

    static class DPolyline {
        public void solve(int testNumber, ScanReader in, PrintWriter out) {
            int x1 = in.scanInt();
            int y1 = in.scanInt();
            int x2 = in.scanInt();
            int y2 = in.scanInt();
            int x3 = in.scanInt();
            int y3 = in.scanInt();

            int ans = 3;
            if (x1 == x2 && x2 == x3) ans = Math.min(ans, 1);
            if ((x1 == x2 && (y3 >= Math.max(y1, y2) || y3 <= Math.min(y1, y2))) || (x1 == x3 && (y2 >= Math.max(y1, y3) || y2 <= Math.min(y1, y3))) || (x3 == x2 && (y1 >= Math.max(y3, y2) || y1 <= Math.min(y3, y2))))
                ans = Math.min(ans, 2);
            if (y1 == y2 && y2 == y3) ans = Math.min(ans, 1);
            if ((y1 == y2 && (x3 >= Math.max(x1, x2) || x3 <= Math.min(x1, x2))) || (y1 == y3 && (x2 >= Math.max(x1, x3) || x2 <= Math.min(x1, x3))) || (y3 == y2 && (x1 >= Math.max(x3, x2) || x1 <= Math.min(x3, x2))))
                ans = Math.min(ans, 2);
            out.println(ans);

        }

    }

    static class ScanReader {
        private byte[] buf = new byte[4 * 1024];
        private int index;
        private BufferedInputStream in;
        private int total;

        public ScanReader(InputStream inputStream) {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (index >= total) {
                index = 0;
                try {
                    total = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (total <= 0) return -1;
            }
            return buf[index++];
        }

        public int scanInt() {
            int integer = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    integer *= 10;
                    integer += n - '0';
                    n = scan();
                }
            }
            return neg * integer;
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

    }
}

