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

public class cf340_d {
    private final boolean fileInput = false;
    private final String fileName = "";

    public void solve() throws IOException {
        long ax = nextLong();
        long ay = nextLong();
        long bx = nextLong();
        long by = nextLong();
        long cx = nextLong();
        long cy = nextLong();

        if ((ax == bx) && (ax == cx) || (ay == by) && (ay == cy)) {
            out.print(1);
        } else if (
                (ax == bx) && ((cy <= Math.min(ay, by)) || (cy >= Math.max(ay, by))) ||
                        (ax == cx) && ((by <= Math.min(ay, cy)) || (by >= Math.max(ay, cy))) ||
                        (ay == by) && ((cx <= Math.min(ax, bx)) || (cx >= Math.max(ax, bx))) ||
                        (ay == cy) && ((bx <= Math.min(ax, cx)) || (bx >= Math.max(ax, cx))) ||
                        (cx == bx) && ((ay <= Math.min(cy, by)) || (ay >= Math.max(cy, by))) ||
                        (by == cy) && ((ax <= Math.min(cx, bx)) || (ax >= Math.max(cx, bx)))
                ) {
            out.print(2);
        } else {
            out.print(3);
        }
    }

    public void run() throws IOException {
        try {
            if (fileInput) {
                br = new BufferedReader(new FileReader(new File(fileName + ".in")));
                out = new PrintWriter(fileName + ".out");
            } else {
                br = new BufferedReader(new InputStreamReader(System.in));
                out = new PrintWriter(System.out);
            }
            solve();
            br.close();
            out.close();
        } catch (IOException e) {

        }

    }

    public static void main(String[] args) throws IOException {
        new cf340_d().run();
    }

    BufferedReader br;
    StringTokenizer in;
    PrintWriter out;

    public String nextToken() throws IOException {
        while (in == null || !in.hasMoreTokens()) {
            try {
                in = new StringTokenizer(br.readLine());
            } catch (IOException | NullPointerException e) {
                throw new IOException();
            }
        }
        return in.nextToken();
    }

    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    public void log(String s) {
        System.out.print(s);
    }

    public void logln(String s) {
        System.out.println(s);
    }
}