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

public class Main {

    public static void solve() {
        int x1 = IO.readInt();
        int y1 = IO.readInt();
        int x2 = IO.readInt();
        int y2 = IO.readInt();
        int x3 = IO.readInt();
        int y3 = IO.readInt();
        int count = 0;
        Pair<Boolean, Integer> l = null;
        Pair<Boolean, Integer> p = isOnOneLine(x1, y1, x2, y2);
        if (p != null) {
            count++;
            l = p;
        }
        p = isOnOneLine(x1, y1, x3, y3);
        if (p != null) {
            count++;
            l = p;
        }
        p = isOnOneLine(x2, y2, x3, y3);
        if (p != null) {
            count++;
            l = p;
        }
        int ans;
        if (count == 3) {
            ans = 1;
        }
        else if (count == 2) {
            ans = 2;
        }
        else if (l != null) {
            if (!l.key) {
                Integer[] line = new Integer[2];
                int t = 0;
                if (x1 == l.value) {
                    if (line[0] == null) {
                        line[0] = y1;
                    }
                    else {
                        line[1] = y1;
                    }
                }
                else {
                    t = y1;
                }

                if (x2 == l.value) {
                    if (line[0] == null) {
                        line[0] = y2;
                    }
                    else {
                        line[1] = y2;
                    }
                }
                else {
                    t = y2;
                }

                if (x3 == l.value) {
                    if (line[0] == null) {
                        line[0] = y3;
                    }
                    else {
                        line[1] = y3;
                    }
                }
                else {
                    t = y3;
                }

                if (t < line[0] && t < line[1]) {
                    ans = 2;
                }
                else if(t > line[0] && t > line[1]) {
                    ans = 2;
                }
                else {
                    ans = 3;
                }
            }
            else {
                Integer[] line = new Integer[2];
                int t = 0;
                if (y1 == l.value) {
                    if (line[0] == null) {
                        line[0] = x1;
                    }
                    else {
                        line[1] = x1;
                    }
                }
                else {
                    t = x1;
                }

                if (y2 == l.value) {
                    if (line[0] == null) {
                        line[0] = x2;
                    }
                    else {
                        line[1] = x2;
                    }
                }
                else {
                    t = x2;
                }

                if (y3 == l.value) {
                    if (line[0] == null) {
                        line[0] = x3;
                    }
                    else {
                        line[1] = x3;
                    }
                }
                else {
                    t = x3;
                }

                if (t < line[0] && t < line[1]) {
                    ans = 2;
                }
                else if(t > line[0] && t > line[1]) {
                    ans = 2;
                }
                else {
                    ans = 3;
                }
            }
        }
        else {
            ans = 3;
        }
        IO.println(ans);
    }

    static Pair<Boolean, Integer> isOnOneLine(int x1, int y1, int x2, int y2) {
        if (x1 == x2) {
            return new Pair<>(false, x1);
        }
        if (y1 == y2) {
            return new Pair<>(true, y1);
        }
        return null;
    }

    // Input/Output ================================
    public static class IO {

        private static Scanner scanner;
        private static PrintWriter writer;

        public static void setUp(InputStream in, OutputStream out) {
            scanner = new Scanner(new java.io.BufferedInputStream(in));
            writer = new PrintWriter(out);
        }

        public static boolean isEmpty() {
            return !scanner.hasNext();
        }

        public static boolean hasNextLine() {
            return scanner.hasNextLine();
        }

        public static String readLine() {
            String line;
            try {
                line = scanner.nextLine();
            }
            catch (Exception e) {
                line = null;
            }
            return line;
        }

        public static String readString() {
            return scanner.next();
        }

        public static int readInt() {
            return scanner.nextInt();
        }

        public static int[] readIntArray(int n) {
            int[] a = new int[n];
            for (int index = 0; index < n; ++index) {
                a[index] = readInt();
            }
            return a;
        }

        public static Pair<Integer, Integer>[] readIntArrayWithIndexes(int n) {
            Pair<Integer, Integer>[] a = new Pair[n];
            for (int index = 0; index < n; ++index) {
                a[index] = new Pair<>(index, readInt());
            }
            return a;
        }

        public static double readDouble() {
            return scanner.nextDouble();
        }

        public static float readFloat() {
            return scanner.nextFloat();
        }

        public static long readLong() {
            return scanner.nextLong();
        }

        public static char readChar() {
            return scanner.findInLine("[^\\s]").charAt(0);
        }

        public static void print(Object o) {
            writer.print(o);
            writer.flush();
        }

        public static void println(Object o) {
            writer.println(o);
            writer.flush();
        }
    }

    // Algorithms ================================

    private static class Algo {

        private static int binSearch(int[] array, int n, int lo, int hi) {
            if (lo > hi) {
                return lo;
            }

            int mid = lo + (hi - lo) / 2;
            int cmp = (int) java.lang.Math.signum(n - array[mid]);
            if (cmp < 0) {
                return binSearch(array, n, lo, mid - 1);
            }
            else if (cmp == 0) {
                return mid;
            }
            else {
                return binSearch(array, n, mid + 1, hi);
            }
        }

        private static void permutations(int n) {
            int[] p = new int[n];
            for (int index = 0; index < n; ++index) {
                p[index] = index + 1;
            }

            while (true) {
                IO.println(Arrays.toString(p));

                int k = n - 1;
                while (k > 0) {
                    if (p[k] < p[k - 1]) {
                        k--;
                    }
                    else {
                        break;
                    }
                }
                if (k == 0) {
                    break;
                }
                int j = n - 1;
                while (p[j] < p[k - 1]) {
                    j--;
                }

                int t = p[j];
                p[j] = p[k - 1];
                p[k - 1] = t;

                int i = 0;
                while (k + i < n - 1 - i) {
                    t = p[k + i];
                    p[k + i] = p[n - i - 1];
                    p[n - i - 1] = t;
                    i++;
                }
            }
        }

        private static boolean isPrime(int number) {
            if (number <= 1) {
                return false;
            }
            if (number <= 3) {
                return true;
            }
            if (number % 2 == 0 || number % 3 == 0) {
                return false;
            }
            int i = 5;
            while (i * i <= number) {
                if (number % i == 0 || number % (i + 2) == 0) {
                    return false;
                }
                i += 6;
            }
            return true;
        }

        private static boolean isPrimeOrOne(int number) {
            return number == 1 || isPrime(number);
        }

        private static boolean isPalindrome(int number) {
            int n = number;
            int reverse = 0;
            while (n > 0) {
                reverse *= 10;
                reverse += (n % 10);
                n /= 10;
            }
            return reverse == number;
        }

        public static int gcd(int a, int b) {
            while (b != 0) {
                int tmp = a % b;
                a = b;
                b = tmp;
            }
            return a;
        }
    }

    private static class Math2 {

        static long c(int n, int k) {
            if (n == 0 && k == 0) {
                return 1;
            }
            int d = 1000;
            int l = 1000000007;
            long[][] c = new long[d + 1][d + 1];
            for (int i = 1; i <= d; ++i) {
                for (int j = 0; j <= i; ++j) {
                    if (i == j || j == 0) {
                        c[i][j] = 1;
                    }
                    else {
                        c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % l;
                    }
                }
            }
            return c[n][k];
        }
    }

    static class Pair<K, V> {
        K key;
        V value;

        Pair(K key, V value) {
            this.key = key;
            this.value = value;
        }
    }

    public static void main(String[] args) {
        IO.setUp(System.in, System.out);
        /*
        try {
            IO.setUp(new FileInputStream("encode.in"), new FileOutputStream("encode.out"));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
            return;
        }
        */
        solve();
    }
}
