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.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Reader;
import java.util.StringTokenizer;

// Codeforces Round #340 (Div. 2)
// Polyline
public class Problem_617_D {
    

    public static void main(String[] args)
    {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        PrintWriter out = new PrintWriter(outputStream);
        Problem_617_D solver = new Problem_617_D();
        solver.solve(1, new InputStreamReader(inputStream), out);
        out.close();
    }

    public void solve(int test, Reader input, PrintWriter out)
    {
        MyScanner in = new MyScanner(input);
        
        int[] x = new int[3];
        int[] y = new int[3];
        int minx, maxx;
        int miny, maxy;
        for(int i = 0; i < 3; i++) {
          x[i] = in.nextInt();
          y[i] = in.nextInt();
        }
        minx = maxx = x[0];
        miny = maxy = y[0];
        for(int i = 1; i < 3; i++) {
          minx = Math.min(x[i], minx);
          maxx = Math.max(x[i], maxx);
          
          miny = Math.min(y[i], miny);
          maxy = Math.max(y[i], maxy);
        }
        
        int w = maxx - minx;
        int h = maxy - miny;
        
        if(w == 0 || h == 0) {
          out.println(1);
          return;
        }
        
        if(contained(x, y, minx, 0, 0, maxy) ||
            contained(x, y, maxx, 0, 0, maxy) ||
                contained(x, y, maxx, 0, 0, miny) ||
                contained(x, y, minx, 0, 0, miny)) {
          out.println(2);
          return;
        }
        out.println(3);
    }

    private boolean contained(int[] x, int[] y, int a, int b, int c, int d)
    {
      boolean[] contains = new boolean[3];
      for(int i = 0; i < 3; i++) {
        if(a == 0) contains[i] |= (y[i] == b);
        else contains[i] |= (x[i] == a);
        if(c == 0) contains[i] |= (y[i] == d);
        else contains[i] |= (x[i] == d);
      }
      return contains[0] & contains[1] & contains[2];
    }

    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner(Reader reader) {
            br = new BufferedReader(reader);
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine(){
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }
    //--------------------------------------------------------

}
