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.*;
import java.util.InputMismatchException;

public class Cf0405D {
    private static InputReader in = new InputReader(System.in);
    private static OutputWriter out = new OutputWriter(System.out);




    private static void solve() throws Exception{
        int aX = in.readInt();
        int aY = in.readInt();
        int bX = in.readInt();
        int bY = in.readInt();
        int cX = in.readInt();
        int cY = in.readInt();
        if((aX==bX)&&(bX==cX)){
            out.println(1);
            return;
        }
        if((aY==bY)&&(bY==cY)){
            out.println(1);
            return;
        }

        if((aX==bX)){
            if(aY<bY){
                if((cY>aY)&&(cY<bY)){
                    out.println(3);
                    return;
                }
                out.println(2);
                return;
            }
            if((cY>bY)&(cY<aY)){
                out.println(3);
                return;
            }
            out.println(2);
            return;
        }
        if((aX==cX)){
            if(aY<cY){
                if((bY>aY)&&(bY<cY)){
                    out.println(3);
                    return;
                }
                out.println(2);
                return;
            }
            if((bY>cY)&(bY<aY)){
                out.println(3);
                return;
            }
            out.println(2);
            return;
        }
        if((cX==bX)){
            if(cY<bY){
                if((aY>cY)&&(aY<bY)){
                    out.println(3);
                    return;
                }
                out.println(2);
                return;
            }
            if((aY>bY)&(aY<cY)){
                out.println(3);
                return;
            }
            out.println(2);
            return;
        }
        int temp = aX;
        aX= aY;
        aY = temp;

        temp = bX;
        bX = bY;
        bY = temp;

        temp = cX;
        cX = cY;
        cY = temp;

        if((aX==bX)){
            if(aY<bY){
                if((cY>aY)&&(cY<bY)){
                    out.println(3);
                    return;
                }
                out.println(2);
                return;
            }
            if((cY>bY)&(cY<aY)){
                out.println(3);
                return;
            }
            out.println(2);
            return;
        }
        if((aX==cX)){
            if(aY<cY){
                if((bY>aY)&&(bY<cY)){
                    out.println(3);
                    return;
                }
                out.println(2);
                return;
            }
            if((bY>cY)&(bY<aY)){
                out.println(3);
                return;
            }
            out.println(2);
            return;
        }
        if((cX==bX)){
            if(cY<bY){
                if((aY>cY)&&(aY<bY)){
                    out.println(3);
                    return;
                }
                out.println(2);
                return;
            }
            if((aY>bY)&(aY<cY)){
                out.println(3);
                return;
            }
            out.println(2);
            return;
        }

        out.println(3);




    }



    public static void main(String[] args) throws Exception {
        solve();
        out.close();
    }


    private static class InputReader {
        private InputStream stream;
        private byte[] buffer;
        private int currentIndex;
        private int bytesRead;

        public InputReader(InputStream stream) {
            this.stream = stream;
            buffer = new byte[131072];
        }


        public InputReader(InputStream stream, int bufferSize) {
            this.stream = stream;
            buffer = new byte[bufferSize];
        }


        private int read() throws IOException {
            if (currentIndex >= bytesRead) {
                currentIndex = 0;
                bytesRead = stream.read(buffer);
                if (bytesRead <= 0) {
                    return -1;
                }
            }
            return buffer[currentIndex++];
        }

        public String readString() throws IOException {
            int c = read();
            while (!isPrintable(c)) {
                c = read();
            }
            StringBuilder result = new StringBuilder();
            do {
                result.appendCodePoint(c);
                c = read();
            } while (isPrintable(c));
            return result.toString();
        }

        public int readInt() throws Exception {
            int c = read();
            int sign = 1;
            while (!isPrintable(c)) {
                c = read();
            }
            if (c == '-') {
                sign = -1;
                c = read();
            }
            int result = 0;
            do {
                if ((c < '0') || (c > '9')) {
                    throw new InputMismatchException();
                }
                result *= 10;
                result += (c - '0');
                c = read();
            } while (isPrintable(c));
            return sign * result;
        }

        public long readLong() throws Exception {
            int c = read();
            int sign = 1;
            while (!isPrintable(c)) {
                c = read();
            }
            if (c == '-') {
                sign = -1;
                c = read();
            }
            long result = 0;
            do {
                if ((c < '0') || (c > '9')) {
                    throw new InputMismatchException();
                }
                result *= 10;
                result += (c - '0');
                c = read();
            } while (isPrintable(c));
            return sign * result;
        }

        public double readDouble() throws Exception {
            int c = read();
            int sign = 1;
            while (!isPrintable(c)) {
                c = read();
            }
            if (c == '-') {
                sign = -1;
                c = read();
            }
            boolean fraction = false;
            double multiplier = 1;
            double result = 0;
            do {
                if ((c == 'e') || (c == 'E')) {
                    return sign * result * Math.pow(10, readInt());
                }
                if ((c < '0') || (c > '9')) {
                    if ((c == '.') && (!fraction)) {
                        fraction = true;
                        c = read();
                        continue;
                    }
                    throw new InputMismatchException();
                }
                if (fraction) {
                    multiplier /= 10;
                    result += (c - '0') * multiplier;
                    c = read();
                } else {
                    result *= 10;
                    result += (c - '0');
                    c = read();
                }
            } while (isPrintable(c));
            return sign * result;
        }

        private boolean isPrintable(int c) {
            return ((c > 32) && (c < 127));
        }
    }

    private static class OutputWriter {
        private PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void println(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

        public void flush() {
            writer.flush();
        }
    }
}