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.awt.*;
import java.io.*;
import java.math.BigInteger;
import java.util.*;

/**
 * Created by Arthur Gazizov on 15.1.16.
 */

public class Main  {
    private static final boolean FILE = !true;
    public static void main(String[] args) throws IOException {
        InputStream inputStream =  System.in;
        OutputStream outputStream = System.out;
        if (FILE){
            inputStream = new FileInputStream("test.txt");
            outputStream = new FileOutputStream("answer.txt");
        }

        FastScanner in = new FastScanner(inputStream);
        FastPrinter out = new FastPrinter(outputStream);
        TaskA solver = new TaskA();
        //int testCount = Integer.parseInt(in.next());
        //for (int i = 1; i <= testCount; i++)
        //solver.solve(i, in, out);
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskA {
    private static final int MOD = (int)1e+9 + 7;
    private static final String YES = "YES";
    private static final String Yes = "Yes";
    private static final String NO = "NO";
    private static final String No = "No";
    private static final String EMPTY = "";
    private static final char SPACE = ' ';
    private static final char ENDL  = '\n';
    public void solve(int testNumber, FastScanner in, FastPrinter out) {
        Point[] points = new Point[3];
        for (int i = 0; i < 3; i++) {
            points[i] = new Point(in.nextInt(), in.nextInt());
        }
        Arrays.sort(points, new Comparator<Point>() {
            @Override
            public int compare(Point o1, Point o2) {
                if (o1.x != o2.x) return  Integer.compare(o1.x, o2.x);
                else if (o1.y != o2.y) return Integer.compare(o1.y, o2.y);
                else return 0;
            }
        });
        Set<Integer> x = new HashSet<>();
        Set<Integer> y = new HashSet<>();
        for (int i = 0; i < 3; i++) {
            x.add(points[i].x);
            y.add(points[i].y);
        }
        int ans = -1;
        if (x.size() == 1){
            ans = 1;
        }
        if (x.size() == 2){
            if (points[0].x == points[1].x){
                if (points[0].y < points[2].y && points[2].y < points[1].y){
                    ans = 3;
                }else ans = 2;
            }else{
                if (points[1].y < points[0].y && points[0].y < points[2].y){
                    ans = 3;
                }else ans = 2;
            }
        }
        if (x.size() == 3){
            if (y.size() == 1) ans = 1;
            else if (y.size() == 3) ans = 3;
            else if (points[1].y == points[0].y || points[1].y == points[2].y) ans = 2;
            else ans = 3;
        }
        out.print(ans);
    }

    private static long dist(Pair<Long, Long> a, Pair<Long, Long> b){
        return ((a.first - b.first) * (a.first - b.first) + (a.second - b.second) * (a.second - b.second));
    }
    public void init(){}

}


/**
 * --------------------------------------------------------------------------------
 * TEMPLATE CODE
 * --------------------------------------------------------------------------------
 * */

class FastScanner extends BufferedReader {
    boolean isEOF;

    public FastScanner(InputStream is) {
        super(new InputStreamReader(is));
    }

    public FastScanner(InputStreamReader inputStreamReader) {
        super(inputStreamReader);
    }

    public int read() {
        try {
            int ret = super.read();
            if (isEOF && ret < 0) {
                throw new InputMismatchException();
            }
            isEOF = ret == -1;
            return ret;
        } catch (IOException e) {
            throw new InputMismatchException();
        }
    }

    public String next() {
        StringBuilder sb = new StringBuilder();
        int c = read();
        while (isWhiteSpace(c)) {
            c = read();
        }
        while (!isWhiteSpace(c)) {
            sb.appendCodePoint(c);
            c = read();
        }
        return sb.toString();
    }

    public static boolean isWhiteSpace(int c) {
        return c >= -1 && c <= 32;
    }

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

    public int nextInt() {
        int c = read();
        while (isWhiteSpace(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int ret = 0;
        while (!isWhiteSpace(c)) {
            if (c < '0' || c > '9') {
                throw new NumberFormatException("digit expected " + (char) c
                        + " found");
            }
            ret = ret * 10 + c - '0';
            c = read();
        }
        return ret * sgn;
    }

    public double nextDouble() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        double res = 0;
        while (!isSpaceChar(c) && c != '.') {
            if (c == 'e' || c == 'E')
                return res * Math.pow(10, nextInt());
            if (c < '0' || c > '9')
                throw new NumberFormatException("digit expected " + (char) c
                        + " found");
            res *= 10;
            res += c - '0';
            c = read();
        }
        if (c == '.') {
            c = read();
            double m = 1;
            while (!isSpaceChar(c)) {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new UnknownError();
                m /= 10;
                res += (c - '0') * m;
                c = read();
            }
        }
        return res * sgn;
    }

    public long nextLong(){
        int c = read();
        while (isWhiteSpace(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long ret = 0;
        while (!isWhiteSpace(c)) {
            if (c < '0' || c > '9') {
                throw new NumberFormatException("digit expected " + (char) c
                        + " found");
            }
            ret = ret * 10 + c - '0';
            c = read();
        }
        return ret * sgn;
    }

    public int[] nextIntArray(int n){
        int[] ret = new int[n];
        for (int i = 0; i < n; i++) {
            ret[i] = nextInt();
        }
        return ret;
    }

    public long[] nextLongArray(int n) {
        long[] ret = new long[n];
        for (int i = 0; i < n; i++) {
            ret[i] = nextLong();
        }
        return ret;
    }
}
/**
final class FastPrinter extends PrintWriter {
    public FastPrinter(OutputStream out) {
        super(out);
    }
    public void print(Object... objects){
        for (int i = 0; i < objects.length - 1; i++) {
            super.print(objects[i]);
            super.print(' ');
        }
        print(objects[objects.length - 1]);
    }
    public void println(Object... objects){
        print(objects);
        super.println();
    }
}
*/
final class FastPrinter {
    private final PrintWriter writer;
    private final StringBuilder builder;

    public FastPrinter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        builder = new StringBuilder();
    }

    public FastPrinter print(Object... objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0) {
                builder.append(' ');
            }
            builder.append(objects[i].toString());
        }
        return this;
    }

    public FastPrinter println(Object... objects) {
        print(objects);
        builder.append('\n');
        return this;
    }
    public void close() {
        writer.print(builder.toString());
        writer.close();
    }
}

class Utils{
    public static final double EPS = 1e-7;
    public static final int max(int... values){
        int ans = Integer.MIN_VALUE;
        for (int i = 0; i < values.length; i++) {
            ans = values[i] > ans? values[i] : ans;
        }
        return ans;
    }
    public static final long max(long... values){
        long ans = Long.MIN_VALUE;
        for (int i = 0; i < values.length; i++) {
            ans = values[i] > ans? values[i] : ans;
        }
        return ans;
    }
    public static final double max(double... values){
        double ans = Double.MIN_VALUE;
        for (int i = 0; i < values.length; i++) {
            ans = values[i] > ans? values[i] : ans;
        }
        return ans;
    }
    public static final int min(int... values){
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < values.length; i++) {
            ans = values[i] < ans? values[i] : ans;
        }
        return ans;
    }
    public static final long min(long... values){
        long ans = Long.MAX_VALUE;
        for (int i = 0; i < values.length; i++) {
            ans = values[i] < ans? values[i] : ans;
        }
        return ans;
    }
    public static final double min(double... values){
        double ans = Double.MAX_VALUE;
        for (int i = 0; i < values.length; i++) {
            ans = values[i] < ans? values[i] : ans;
        }
        return ans;
    }
    public static final int abs(int value){return value >= 0? value: -value;}
    public static final long abs(long value){return value >= 0? value: -value;}
    public static final double abs(double value){return value >= 0? value: -value;}
    public static final int sign(double value){
        if (value > EPS) return 1;
        if (value < -EPS) return -1;
        return 0;
    }
    public static final boolean equals(double a, double b){
        return abs(a - b) < EPS;
    }
}

class Pair<U, V> implements Comparable<Pair<U, V>> {
    public final U first;
    public final V second;

    public static<U, V> Pair<U, V> makePair(U first, V second) {
        return new Pair<U, V>(first, second);
    }

    private Pair(U first, V second) {
        this.first = first;
        this.second = second;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Pair pair = (Pair) o;

        return !(first != null ? !first.equals(pair.first) : pair.first != null) && !(second != null ? !second.equals(pair.second) : pair.second != null);

    }

    public int hashCode() {
        int result = first != null ? first.hashCode() : 0;
        result = 31 * result + (second != null ? second.hashCode() : 0);
        return result;
    }

    public String toString() {
        return "(" + first + "," + second + ")";
    }

    public int compareTo(Pair<U, V> o) {
        int value = ((Comparable<U>)first).compareTo(o.first);
        if (value != 0)
            return value;
        return ((Comparable<V>)second).compareTo(o.second);
    }
}
