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>
def main():
	temp1 = input().split()
	point1 = [int(x) for x in temp1]
	temp2 = input().split()
	point2 = [int(x) for x in temp2]
	temp3 = input().split()
	point3 = [int(x) for x in temp3]
	print(solver(point1, point2, point3))

def solver(point1, point2, point3):
	# 1 line
	if sameX(point1, point2) and sameX(point2, point3):
		return 1
	elif sameY(point1, point2) and sameY(point2, point3):
		return 1
	# 2 lines
	if has2Segment(point1, point2, point3):
		return 2
	elif has2Segment(point1, point3, point2):
		return 2
	elif has2Segment(point2, point3, point1):
		return 2
	# (sameY(point1, point3) or sameY(point2, point3)):
	# 		return 2
	# elif sameY(point1, point2) and \
	# (sameX(point1, point3) or sameX(point2, point3)):
	# 		return 2
	# elif sameX(point1, point3) and sameY(point2, point3):
	# 		return 2
	# elif sameY(point1, point3) and sameX(point2, point3):
	# 		return 2
	# 3 lines
	else:
		return 3

# tests if point1 and point2 are collinear 
# and attach point3 through a second segment
def has2Segment(point1, point2, point3):
	if sameX(point1, point2):
		top = max(point1[1], point2[1])
		bottom = min(point1[1], point2[1])
		if point3[1] >= top or point3[1] <= bottom:
			return True
		else:
			return False
	elif sameY(point1, point2):
		right = max(point1[0], point2[0])
		left = min(point1[0], point2[0])
		if point3[0] >= right or point3[0] <= left:
			return True
		else:
			return False
	else:
		return False


def sameX(point1, point2):
	return point1[0] == point2[0]

def sameY(point1, point2):
	return point1[1] == point2[1]

main()
# a = "1 -1"
# a = a.split()
# print(a)
# a = [int(x) for x in a]
# print(a)
#print(solver((1, -1), (1, 1), (1, 2)))
#print(solver((-1, -1), (-1, 3), (4, 3)))
#print(solver((1, 1), (2, 3), (3, 2)))
#print(solver((899431605, 238425805
#), (899431605, 339067352), (940909482, 333612216
#)))
#print(solver((-2, -4), (-2, 2), (-1, 3)))