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>

//package solution;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Solution implements Runnable {
    
    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");
    final boolean OJ = System.getProperty("ONLINE_JUDGE") != null;
    
    void init() throws FileNotFoundException {
        if (OJ) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        } else {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        }
            
    }
    
    public void run() {
        try {
            init();
            solve();
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(-1);
        }
    }
    
    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        
        return tok.nextToken();
    }
    
    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    public static void main(String[] args) {
        new Thread(null, new Solution(), "", 256 * 1l << 20).start();
    }
    
    boolean go(int x1, int x2, int x3, int y1, int y2, int y3) {
        if (x1 == x2) {
            if (y3 <= Math.min(y1, y2) || y3 >= Math.max(y1, y2)) return true;
            return false;
        }
        return false;
    }
    
    void solve() throws IOException {
        int x1, y1, x2, y2, x3, y3;
        x1 = readInt();
        y1 = readInt();
        x2 = readInt();
        y2 = readInt();
        x3 = readInt();
        y3 = readInt();
        if ((x1 == x2 && x1 == x3) || (y1 == y2 && y2 == y3)) {
            out.println("1");
        } else if (go(x1, x2, x3, y1, y2, y3) || go(x2, x3, x1, y2, y3, y1) || go(x1, x3, x2, y1, y3, y2) || go(y1, y2, y3, x1, x2, x3) || go(y1, y3, y2, x1, x3, x2) || go(y2, y3, y1, x2, x3, x1)) {
            out.println("2");
            
        } else {
            out.println("3");
        }
    }
}
