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.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.PriorityQueue;
/**
 * Erasyl Abenov
 * 
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
            try (PrintWriter out = new PrintWriter(outputStream)) {
                Task solver = new Task();
                solver.solve(1, in, out);
            }
    }
}
  
class Task {
    private static boolean isTwo(long a0, long b0, long a1, long b1, long a2, long b2){
        return ((a0 >= a2 && a1 <= a2) || (a0 <= a2 && a1 >= a2)) && (b2 == b1 || b2 == b0);
    }
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        long a[] = new long[3];
        long b[] = new long[3];
        HashSet setx = new HashSet();
        HashSet sety = new HashSet();
        for(int i = 0; i < 3; ++i){
            a[i] = in.nextLong();
            b[i] = in.nextLong();
            setx.add(a[i]);
            sety.add(b[i]);
        }
        if(setx.size() == 1 || sety.size() == 1){
            out.println(1);
            return;
        }
        for(int i = 0; i < 3; ++i){
            for(int j = 0; j < 3; ++j){
                for(int k = 0; k < 3; ++k){
                    if(k != i && k != j && i != j){
                        if(isTwo(a[i], b[i], a[j], b[j], a[k], b[k]) || isTwo(b[i], a[i], b[j], a[j], b[k], a[k])){
                            out.println(2);
                            return;
                        }
                    }
                }
            }
        }
        out.println(3);
    }
}
class InputReader {
    private final BufferedReader reader;
    private StringTokenizer tokenizer;
  
    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }
  
    public String nextLine() {
        try {
            return reader.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
  
    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(nextLine());
        }
        return tokenizer.nextToken();
    }
  
    public int nextInt() {
        return Integer.parseInt(next());
    }
    public long nextLong() {
        return Long.parseLong(next());
    }
    public BigInteger nextBig() {
        return new BigInteger(next());
    }
}