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

public class CF340D {

    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;
    boolean eof;
    void solve() throws IOException {
        int n = 3;
        long[] x = new long[n];
        long[] y = new long[n];
        for(int i = 0; i < n; i++) {
            x[i] = nextLong();
            y[i] = nextLong();
        }
        if(isP(x) || isP(y)) {
            out(1);
            return;
        }

        for(int i = 0; i < n; i++) {
            for(int j = i + 1; j < n; j++) {
                if(x[i] == x[j]) {
                    long min = Math.min(y[i], y[j]);
                    long max = Math.max(y[i], y[j]);
                    long v = -1;
                    for(int k = 0; k < n; k++) {
                        if(k != i && k != j) {
                            v = y[k];
                        }
                    }
                    if(v > min && v < max) {
                        out(3);
                        return;
                    }
                    else {
                        out(2);
                        return;
                    }
                }

                if(y[i] == y[j]) {
                    long min = Math.min(x[i], x[j]);
                    long max = Math.max(x[i], x[j]);
                    long v = -1;
                    for(int k = 0; k < n; k++) {
                        if(k != i && k != j) {
                            v = x[k];
                        }
                    }
                    if(v > min && v < max) {
                        out(3);
                        return;
                    }
                    else {
                        out(2);
                        return;
                    }
                }
            }
        }
        out(3);
    }
    public boolean isP(long[] arr) {
        int n = arr.length;
        for(int i = 1; i < n; i++) {
            if(arr[i] != arr[0]) {
                return false;
            }
        }
        return true;
    }

    private void outln(Object o) {
        System.out.println(o);
    }
    private void out(Object o) {
        System.out.print(o);
    }
    public CF340D() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }
    public static void main(String[] args) throws IOException {
        new CF340D();
    }

    public long[] nextLongArr(int n) throws IOException{
        long[] res = new long[n];
        for(int i = 0; i < n; i++)
            res[i] = nextLong();
        return res;
    }
    public int[] nextIntArr(int n) throws IOException {
        int[] res = new int[n];
        for(int i = 0; i < n; i++)
            res[i] = nextInt();
        return res;
    }
    public String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return null;
            }
        }
        return st.nextToken();
    }
    public String nextString() {
        try {
            return br.readLine();
        } catch (IOException e) {
            eof = true;
            return null;
        }
    }
    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
}
