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

import static java.lang.Math.*;

public class Main {
    FastScanner in;
    PrintWriter out;

    static final String FILE = "";

    long getDist(long x, long y, long a, long b) {
        return (x - a) * (x - a) + (y - b) * (y - b);
    }

    public void solve() {
        long x1 = in.nextLong(), y1 = in.nextLong();
        long x2 = in.nextLong(), y2 = in.nextLong();
        long x3 = in.nextLong(), y3 = in.nextLong();

        if (x1 == x2 && x2 == x3) {
            out.print(1);
            return;
        }
        if (y1 == y2 && y2 == y3) {
            out.print(1);
            return;
        }

        if (y1 == y2 && ((x3 >= x1 && x3 >= x2) || (x3 <= x1 && x3 <= x2))) {
            out.print(2);
            return;
        }

        if (y3 == y2 && ((x1 >= x3 && x1 >= x2) || (x1 <= x3 && x1 <= x2))) {
            out.print(2);
            return;
        }

        if (y3 == y1 && ((x2 >= x3 && x2 >= x1) || (x2 <= x3 && x2 <= x1))) {
            out.print(2);
            return;
        }

        if (x1 == x2 && ((y3 >= y1 && y3 >= y2) || (y3 <= y1 && y3 <= y2))) {
            out.print(2);
            return;
        }

        if (x3 == x2 && ((y1 >= y3 && y1 >= y2) || (y1 <= y3 && y1 <= y2))) {
            out.print(2);
            return;
        }

        if (x3 == x1 && ((y2 >= y3 && y2 >= y1) || (y2 <= y3 && y2 <= y1))) {
            out.print(2);
            return;
        }

        out.print(3);

        // GOSHA, TY SHREK
    }

    public void run() {
        if (FILE.equals("")) {
            in = new FastScanner(System.in);
            out = new PrintWriter(System.out);
        } else {
            try {
                in = new FastScanner(new FileInputStream(FILE +
                        ".in"));
                out = new PrintWriter(new FileOutputStream(FILE +
                        ".out"));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }
        solve();
        out.close();
    }

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

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
        }

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

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

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

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

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

        public float nextFloat() {
            return Float.parseFloat(next());
        }
    }

    class Pair<A extends Comparable<A>, B extends Comparable<B>>
            implements Comparable<Pair<A, B>> {
        public A a;
        public B b;

        public Pair(A a, B b) {
            this.a = a;
            this.b = b;
        }

        @Override
        public int compareTo(Pair<A, B> o) {
            if (o == null || o.getClass() != getClass())
                return 1;
            int cmp = a.compareTo(o.a);
            if (cmp == 0)
                return b.compareTo(o.b);
            return cmp;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            Pair<?, ?> pair = (Pair<?, ?>) o;

            if (a != null ? !a.equals(pair.a) : pair.a != null) return
                    false;
            return !(b != null ? !b.equals(pair.b) : pair.b != null);
        }
    }

    class PairInt extends Pair<Integer, Integer> {
        public PairInt(Integer u, Integer v) {
            super(u, v);
        }
    }

    class PairLong extends Pair<Long, Long> {
        public PairLong(Long u, Long v) {
            super(u, v);
        }
    }

}