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.*;
import java.math.*;
 
public class Main
{
	static int comparePoints(int mask, int arrX[], int arrY[]){
		int idx = 0;
		int x[] = new int[3], y[] = new int[3];

		for(int i = 0, tmp = mask; i < 3; i++){
			if((mask & 1) == 1){
				x[idx] = arrX[i];
				y[idx] = arrY[i];
				++idx;
			}else{
				x[2] = arrX[i];
				y[2] = arrY[i];
			}

			mask /= 2;
		}

		// x-coords are the same and y[2] doesn't lie bw y[0] & y[1]
		if(x[0] == x[1] && (y[2] >= Math.max(y[0], y[1]) || y[2] <= Math.min(y[0], y[1]))){
			trace(Arrays.toString(x) , Arrays.toString(y));
			return 2;
		}

		// y-coords are the same and x[2] doesn't lie bw x[0] & x[1]
		if(y[0] == y[1] && (x[2] >= Math.max(x[0], x[1]) || x[2] <= Math.min(x[0], x[1]))){
			trace(Arrays.toString(x) , Arrays.toString(y));
			return 2;
		}

		return 3;
	}

    public static void process(int test_number)throws IOException
    {
        int x[] = new int[3], y[] = new int[3];
        for(int i = 0; i < 3; i++){
            x[i] = ni();
            y[i] = ni();
        }

        int res = 3;

        if((x[0] == x[1] && x[1] == x[2]) || (y[0] == y[1] && y[1] == y[2])){
        	pn("1");
        } else{
        	for(int i = 0; i <= 7; i++){
        		if(Integer.bitCount(i) != 2)
        			continue;

        		int reqSeg = comparePoints(i, x, y);
        		res = Math.min(res, reqSeg);
        	}

        	pn(res);
        }
    }
 
    static final long mod = (long)1e9+7l;
    static boolean DEBUG = false;
    static FastReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        out = new PrintWriter(System.out);
        sc = new FastReader();
 
        long s = System.currentTimeMillis();
        int t = 1;
        // t = ni();
        for(int i = 1; i <= t; i++)
            process(i);
 
        out.flush();
        System.err.println(System.currentTimeMillis()-s+"ms");
    }

    static void trace(Object... o){ if(!DEBUG) return; System.err.println(Arrays.deepToString(o)); };    
    static void pn(Object o){ out.println(o); }
    static void p(Object o){ out.print(o); }
    static int ni()throws IOException{ return Integer.parseInt(sc.next()); }
    static long nl()throws IOException{ return Long.parseLong(sc.next()); }
    static double nd()throws IOException{ return Double.parseDouble(sc.next()); }
    static String nln()throws IOException{ return sc.nextLine(); }
    static long gcd(long a, long b){ return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b){ return (b==0)?a:gcd(b,a%b); }
    
    static class FastReader{ 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader(){ 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next(){ 
            while (st == null || !st.hasMoreElements()){ 
                try{ st = new StringTokenizer(br.readLine()); } catch (IOException  e){ e.printStackTrace(); } 
            } 
            return st.nextToken(); 
        } 
  
        String nextLine(){ 
            String str = ""; 
            try{ str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } 
            return str; 
        } 
    } 
}
