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>
#!/usr/bin/python

import os
import sys
import itertools

def solve(f):
    plist = [f.read_long_list() for _ in xrange(3)]

    if all(p[0] == plist[0][0] for p in plist) or all(p[1] == plist[0][1] for p in plist):
        return 1

    if len(set([p[0] for p in plist])) == 2:
        if plist[0][0] == plist[1][0]:
            ylist = sorted([plist[0][1], plist[1][1]])
            if plist[2][1] <= ylist[0] or ylist[1] <= plist[2][1]:
                return 2
        if plist[0][0] == plist[2][0]:
            ylist = sorted([plist[0][1], plist[2][1]])
            if plist[1][1] <= ylist[0] or ylist[1] <= plist[1][1]:
                return 2
        if plist[1][0] == plist[2][0]:
            ylist = sorted([plist[1][1], plist[2][1]])
            if plist[0][1] <= ylist[0] or ylist[1] <= plist[0][1]:
                return 2

    if len(set([p[1] for p in plist])) == 2:
        if plist[0][1] == plist[1][1]:
            ylist = sorted([plist[0][0], plist[1][0]])
            if plist[2][0] <= ylist[0] or ylist[1] <= plist[2][0]:
                return 2
        if plist[0][1] == plist[2][1]:
            ylist = sorted([plist[0][0], plist[2][0]])
            if plist[1][0] <= ylist[0] or ylist[1] <= plist[1][0]:
                return 2
        if plist[1][1] == plist[2][1]:
            ylist = sorted([plist[1][0], plist[2][0]])
            if plist[0][0] <= ylist[0] or ylist[1] <= plist[0][0]:
                return 2

    return 3


class Reader(object):
    def __init__(self, filename=None):
        if filename: self.f = open(filename)
        else: self.f = sys.stdin

    def read_int(self):
        return int(self.f.readline().strip())
    def read_float(self):
        return float(self.f.readline().strip())
    def read_long(self):
        return long(self.f.readline().strip())
    def read_str(self):
        return self.f.readline().strip()

    def read_int_list(self):
        return [int(item) for item in self.f.readline().split()]
    def read_float_list(self):
        return [float(item) for item in self.f.readline().split()]
    def read_long_list(self):
        return [long(item) for item in self.f.readline().split()]
    def read_str_list(self):
        return self.f.readline().split()

if __name__ == '__main__':
    filename = sys.argv[1] if len(sys.argv)>1 else None
    f = Reader(filename)
    print solve(f)
