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.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main {
    public static void main(String[] args) {
//     Test.testing();
        ConsoleIO io = new ConsoleIO();
        new Main(io).solve();
        io.flush();
    }
    ConsoleIO io;
    Main(ConsoleIO io) {
        this.io = io;
    }

    ArrayList<ArrayList<Edge>> gr1;
    boolean[] visit;
    //

    class Pair{
        public Pair(long a, long b){
            this.a = a;
            this.b = b;
        }
        public long a;
        public long b;
    }

    class Edge {
        public Edge(int c, int u,int v) {
            this.u = u;
            this.v = v;
            this.c = c;
        }
        public int u;
        public int v;
        public int c;
    }

    long mod = 1_000_000_007;
    int n,m,fn;

    public void solve() {
        int[] l = io.readIntArray();
        long x1 = l[0],y1 = l[1];
        l = io.readIntArray();
        long x2 = l[0],y2 = l[1];
        l = io.readIntArray();
        long x3 = l[0],y3 = l[1];
        if(x1==x2 && x2 == x3 || y1==y2&&y2==y3) {
            io.writeLine("1");
            return;
        }
        if(check2(x1,x2,x3,y1,y2,y3) || check2(y1,y2,y3,x1,x2,x3))
            io.writeLine("2");
        else
            io.writeLine("3");
    }

    boolean check2(long a1,long a2, long a3,long b1,long b2, long b3){
        if(a1==a2){
            return b3<=b1&&b3<=b2 || b3>=b1&&b3>=b2;
        }else if (a1==a3)
            return b2<=b3&&b2<=b1 || b2>=b1&&b2>=b3;
        else if(a2==a3)
            return b1<=b2&&b1<=b3 || b1>=b2&&b1>=b3;
        else return false;
    }

    long dist(long x1,long y1, long x2,long y2){
        long dx = x1-x2,dy = y1-y2;
        return dx*dx+dy*dy;
    }

    long gcd(long a, long b) {
        if (a < b) return gcd(b, a);
        if (b == 0) return a;
        return gcd(b, a % b);
    }


}

class ConsoleIO {
    BufferedReader br;
    PrintWriter out;
    public ConsoleIO(){br = new BufferedReader(new InputStreamReader(System.in));out = new PrintWriter(System.out);}
    public void flush(){this.out.close();}
    public void writeLine(String s) {this.out.println(s);}
    public void writeInt(int a) {this.out.print(a);this.out.print(' ');}
    public void writeWord(String s){
        this.out.print(s);
    }
    public String readLine() {try {return br.readLine();}catch (Exception ex){ return "";}}
    public long readLong() {
        return Long.parseLong(this.readLine());
    }
    public int readInt() {
        return Integer.parseInt(this.readLine().trim());
    }
    public long[] readLongArray() {
        String[]n=this.readLine().trim().split(" ");long[]r=new long[n.length];
        for(int i=0;i<n.length;i++)r[i]=Long.parseLong(n[i]);
        return r;
    }
    public int[] readIntArray() {
        String[]n=this.readLine().trim().split("\\s+");int[]r=new int[n.length];
        for(int i=0;i<n.length;i++)r[i]=Integer.parseInt(n[i]);
        return r;
    }
    public void writeIntArray(int[] a) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < a.length; i++) {if (i > 0) sb.append(' ');sb.append(a[i]);}
        this.writeLine(sb.toString());
    }
}


