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>
/*
     * Code Author: Akshay Miterani
     * DA-IICT
     */
    import java.io.*;
    import java.util.*;

    
     
    public class MainA {
     
    	static double eps=(double)1e-6;
    	static long mod=(int)1e9+7;
    	public static void main(String args[]){
    		InputReader in = new InputReader(System.in);
    		OutputStream outputStream = System.out;
    		PrintWriter out = new PrintWriter(outputStream);
    		//----------My Code Starts Here----------
    		long x1=in.nextLong();
    		long y1=in.nextLong();
    		long x2=in.nextLong();
    		long y2=in.nextLong();
    		long x3=in.nextLong();
    		long y3=in.nextLong();
    		if((x1==x2 && x2==x3) || (y1==y2 && y2==y3)){
    			System.out.println("1");
    			return;
    		}
    		if(y1==y2)
        	{
        		if(x3>x1&&x3<x2)
        			System.out.println("3");
        		else if(x3<x1&&x3>x2)
        			System.out.println("3");
        		else
        			System.out.println("2");
        	}
        	else if(y3==y2)
        	{
        		if(x1>x3&&x1<x2)
        			System.out.println("3");
        		else if(x1<x3&&x1>x2)
        			System.out.println("3");
        		else
        			System.out.println("2");
        	}
        	else if(y1==y3)
        	{
        		if(x2>x1&&x2<x3)
        			System.out.println("3");
        		else if(x2<x1&&x2>x3)
        			System.out.println("3");
        		else
        			System.out.println("2");
        	}
        	else if(x1==x2)
        	{
        		if(y3>y1&&y3<y2)
        			System.out.println("3");
        		else if(y3<y1&&y3>y2)
        			System.out.println("3");
        		else
        			System.out.println("2");
        	}
        	else if(x3==x2)
        	{
        		if(y1>y3&&y1<y2)
        			System.out.println("3");
        		else if(y1<y3&&y1>y2)
        			System.out.println("3");
        		else
        			System.out.println("2");
        	}
        	else if(x1==x3)
        	{
        		if(y2>y1&&y2<y3)
        			System.out.println("3");
        		else if(y2<y1&&y2>y3)
        			System.out.println("3");
        		else
        			System.out.println("2");
        	}
        	else
        		System.out.println("3");
    		out.close();
    		//---------------The End------------------
    	}
    	
    	static class Pair implements Comparable<Pair>{
    		long x;
    		long y;
    		int i;
    		Pair(long xx,long yy){
    			x=xx;
    			y=yy;
    		}
    		@Override
    		public int compareTo(Pair o) {
    			if(this.y==o.y)
					return Long.compare((this.x),(o.x));
				else
					return Long.compare((this.y),(o.y));
    		}
    	}
    	
    	static class InputReader {
    	    public BufferedReader reader;
    	    public StringTokenizer tokenizer;
     
    	    public InputReader(InputStream inputstream) {
    	      reader = new BufferedReader(new InputStreamReader(inputstream));
    	      tokenizer = null;
    	    }
    	    
    	    public String nextLine(){
    	    	String fullLine=null;
    	    	while (tokenizer == null || !tokenizer.hasMoreTokens()) {
    	            try {
    	              fullLine=reader.readLine();
    	            } catch (IOException e) {
    	              throw new RuntimeException(e);
    	            }
    	            return fullLine;
    	          }
    	          return fullLine;
    	    }
    		public String next() {
    	      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
    	        try {
    	          tokenizer = new StringTokenizer(reader.readLine());
    	        } catch (IOException e) {
    	          throw new RuntimeException(e);
    	        }
    	      }
    	      return tokenizer.nextToken();
    	    }
    		public long nextLong() {
    		      return Long.parseLong(next());
    		    }
    	    public int nextInt() {
    	      return Integer.parseInt(next());
    	    }
    	  }
    } 