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



public class Main {  
	  
    public static void main(String[] args) {  
        InputStream inputStream = System.in;  
        OutputStream outputStream = System.out;  
        Scanner in = new Scanner(inputStream);  
        PrintWriter out = new PrintWriter(outputStream);  
        TaskE solver = new TaskE();  
        solver.solve(1, in, out);  
        out.close();  
    }  
    
	static int []x = new int[3];
	static int []y = new int[3];

    static class MyComprator implements Comparator {
        public int compare(Object arg0, Object arg1) {
            return 1;
        }
    }
    
    static boolean judge(int a, int b, int c) {
    	if(x[a] == x[b] && (Math.min(y[a],  y[b]) >= y[c] || y[c] >= Math.max(y[b], y[a])) ) return true;
    	if(y[a] == y[b] && (Math.min(x[a],  x[b]) >= x[c] || x[c] >= Math.max(x[b], x[a])) ) return true;
    	return false;
    }
    
    static class TaskE {  
        public void solve(int testNumber, Scanner in, PrintWriter out) {  

        	for(int i = 0; i < 3; i++) {
        		x[i] = in.nextInt();
        		y[i] = in.nextInt();
        	}
        	if((x[0] == x[1] && x[1] == x[2]) || (y[0] == y[1] && y[1] == y[2])) out.println(1);
        	else if(judge(0, 1, 2) || judge(0, 2, 1) ) out.println(2);
        	else if(judge(1, 0, 2) || judge(1, 2, 0)) out.println(2);
        	else if(judge(2, 0, 1) || judge(2, 1, 0)) out.println(2);
        	else out.println(3);
        }  
    }  

    static class pii implements Comparable<pii> {  
        int X, Y;  
        pii() {  
            this.X = 0;  
            this.Y = 0;  
        }  
        pii(int X, int Y) {  
            this.X = X;  
            this.Y = Y;  
        }  
        public int compareTo(pii a) {  
            if(this.X - a.X != 0) return this.X - a.X;  
            else return this.Y - a.Y;  
        }  
    }  
    static class Scanner {    
        BufferedReader br;    
        StringTokenizer st;    
                
        public Scanner(InputStream in) {  
            br = new BufferedReader(new InputStreamReader(in));  
            eat("");  
        }   
          
        private void eat(String s) {    
            st = new StringTokenizer(s);  
        }    
        
        public String nextLine() {    
            try {    
                return br.readLine();    
            } catch (IOException e) {    
                return null;    
            }    
        }    
        
        public boolean hasNext() {    
            while (!st.hasMoreTokens()) {    
                String s = nextLine();    
                if (s == null)    
                return false;    
                eat(s);    
            }    
            return true;    
        }    
        
        public String next() {    
            hasNext();    
            return st.nextToken();    
        }    
        
        public int nextInt() {    
            return Integer.parseInt(next());    
        }    
            
        public long nextLong() {    
            return Long.parseLong(next());    
        }    
                
        public double nextDouble() {    
            return Double.parseDouble(next());    
        }    
            
        public BigInteger nextBigInteger() {    
            return new BigInteger(next());    
        }    
            
    }    
}   