The Chef is given a list of N triangles. Each triangle is identfied by the coordinates of its three corners in the 2-D cartesian plane. His job is to figure out how many
of the given triangles are right triangles. A right triangle is a triangle in which one angle is a 90 degree angle. The vertices
of the triangles have integer coordinates and all the triangles given are valid( three points aren't colinear ).  
 
------ Input ------ 

The first line of the input contains an integer N denoting the number of triangles. Each of the following N
lines contain six space separated integers x1 y1 x2 y2 x3 y3 where (x1, y1),
(x2, y2) and (x3, y3) are the vertices of a triangle.
 
------ Output ------ 

Output one integer, the number of right triangles among the given triangles.
 
------ Constraints ------ 

$1 ≤ N ≤ 100000  (10^{5})$
$ 0 ≤ x1, y1, x2, y2, x3, y3 ≤ 20$
 
----- Sample Input 1 ------ 
5
0 5 19 5 0 0
17 19 12 16 19 0
5 14 6 13 8 7
0 4 0 14 3 14
0 2 0 14 9 2
----- Sample Output 1 ------ 
3
----- explanation 1 ------ 
The first triangle and the last two triangles of the example are right triangles.

Difficulty: EASY

Solutions:
n = int(input())
c = 0
for i in range(n):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	if (y1 - y2) * (y3 - y2) == (x2 - x1) * (x3 - x2) or (y2 - y3) * (y1 - y3) == (x3 - x2) * (x1 - x3) or (y3 - y1) * (y2 - y1) == (x1 - x3) * (x2 - x1):
		c = c + 1
print(c)


count = 0
for i in range(int(input())):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	a = abs(x2 - x1) ** 2 + abs(y2 - y1) ** 2
	b = abs(x3 - x2) ** 2 + abs(y3 - y2) ** 2
	c = abs(x3 - x1) ** 2 + abs(y3 - y1) ** 2
	if a + b == c or b + c == a or c + a == b:
		count = count + 1
print(count)


def vector(p, q):
	return (q[0] - p[0], q[1] - p[1])

def multi(p, q):
	return p[0] * q[0] + p[1] * q[1]
ans = 0
for _ in range(int(input())):
	(a, b, c, d, e, f) = map(int, input().split())
	(p1, p2, p3) = ((a, b), (c, d), (e, f))
	(v1, v2, v3) = (vector(p1, p2), vector(p2, p3), vector(p3, p1))
	if 0 in [multi(v1, v2), multi(v2, v3), multi(v3, v1)]:
		ans += 1
print(ans)


count = 0
for _ in range(int(input())):
	(x1, y1, x2, y2, x3, y3) = [int(i) for i in input().split()]
	ab = (x2 - x1) ** 2 + (y2 - y1) ** 2
	bc = (x3 - x2) ** 2 + (y3 - y2) ** 2
	ac = (x3 - x1) ** 2 + (y3 - y1) ** 2
	if ab == ac + bc or bc == ac + ab or ac == ab + bc:
		count += 1
print(count)


import math

def distance(p1, p2):
	return math.sqrt(pow(p1[0] - p2[0], 2) + pow(p1[1] - p2[1], 2))

def is_right_triangle(tri, tol=1e-06):
	lengths = []
	lengths.append(distance(tri[0], tri[1]))
	lengths.append(distance(tri[0], tri[2]))
	lengths.append(distance(tri[1], tri[2]))
	lengths.sort()
	val1 = pow(lengths[0], 2) + pow(lengths[1], 2) - pow(lengths[-1], 2)
	val1 = abs(val1)
	if val1 < tol:
		return True
	else:
		return False
T = int(input())
count = 0
for var in range(0, T):
	temp = input().split(' ')
	for var in range(0, len(temp)):
		temp[var] = int(temp[var])
	arr = []
	arr.append([temp[0], temp[1]])
	arr.append([temp[2], temp[3]])
	arr.append([temp[4], temp[5]])
	if is_right_triangle(arr):
		count += 1
print(count)


n = int(input())
ans = 0
for _ in range(n):
	m = list(map(int, input().split()))
	sides = ((m[0] - m[2]) ** 2 + (m[1] - m[3]) ** 2, (m[2] - m[4]) ** 2 + (m[3] - m[5]) ** 2, (m[4] - m[0]) ** 2 + (m[5] - m[1]) ** 2)
	sides = sorted(sides)
	if sides[-1] == sides[0] + sides[1]:
		ans += 1
print(ans)


res = 0
for _ in range(int(input())):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	a = pow(x2 - x1, 2) + pow(y2 - y1, 2)
	b = pow(x3 - x2, 2) + pow(y3 - y2, 2)
	c = pow(x1 - x3, 2) + pow(y1 - y3, 2)
	if a == b + c or b == a + c or c == a + b:
		res += 1
print(res)


count = 0
for _ in range(int(input())):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	X = (x2 - x1) ** 2 + (y2 - y1) ** 2
	Y = (x3 - x1) ** 2 + (y3 - y1) ** 2
	Z = (x3 - x2) ** 2 + (y2 - y3) ** 2
	if X == Y + Z or Y == X + Z or Z == Y + X:
		count += 1
print(count)


tc = int(input())
count = 0
for _ in range(tc):
	arr = [int(x) for x in input().split()]
	side1 = (arr[0] - arr[2]) ** 2 + (arr[1] - arr[3]) ** 2
	side2 = (arr[2] - arr[4]) ** 2 + (arr[3] - arr[5]) ** 2
	side3 = (arr[4] - arr[0]) ** 2 + (arr[5] - arr[1]) ** 2
	length = [side3, side2, side1]
	length.sort()
	if length[0] + length[1] == length[2]:
		count += 1
print(count)


c = 0
for _ in range(int(input())):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	s1 = (x1 - x2) ** 2 + (y1 - y2) ** 2
	s2 = (x1 - x3) ** 2 + (y1 - y3) ** 2
	s3 = (x2 - x3) ** 2 + (y2 - y3) ** 2
	l = [s1, s2, s3]
	l.sort()
	if l[2] == l[0] + l[1]:
		c += 1
print(c)


def distance(a, b, c, d):
	d = ((a - c) ** 2 + (b - d) ** 2) ** (1 / 2)
	return d
c = 0
n = 0
T = int(input())
for tc in range(T):
	A = []
	(p, q, r, s, t, u) = map(int, input().split(' '))
	d1 = distance(p, q, r, s)
	d2 = distance(p, q, t, u)
	d3 = distance(r, s, t, u)
	d1 = round(d1 ** 2, 2)
	d2 = round(d2 ** 2, 2)
	d3 = round(d3 ** 2, 2)
	A.append(d1)
	A.append(d2)
	A.append(d3)
	A.sort()
	n += 1
	if A[2] == A[1] + A[0]:
		c += 1
print(c)


n = int(input())
valid = 0
for i in range(n):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	s1 = (x2 - x1) ** 2 + (y2 - y1) ** 2
	s2 = (x3 - x2) ** 2 + (y3 - y2) ** 2
	s3 = (x3 - x1) ** 2 + (y3 - y1) ** 2
	sq = [s1, s2, s3]
	sq.sort()
	if sq[2] == sq[0] + sq[1]:
		valid += 1
print(valid)


right = 0
for tc in range(int(input())):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	d1 = (x1 - x2) ** 2 + (y1 - y2) ** 2
	d2 = (x3 - x2) ** 2 + (y3 - y2) ** 2
	d3 = (x1 - x3) ** 2 + (y1 - y3) ** 2
	sides = [d1, d2, d3]
	sides.sort()
	if sides[0] + sides[1] == sides[2]:
		right += 1
print(right)


n = int(input())
count = 0
for i in range(n):
	(x1, y1, x2, y2, x3, y3) = list(map(int, input().split()))
	d1 = (x2 - x1) ** 2 + (y2 - y1) ** 2
	d2 = (x3 - x2) ** 2 + (y3 - y2) ** 2
	d3 = (x3 - x1) ** 2 + (y3 - y1) ** 2
	if d1 + d2 == d3 or d1 + d3 == d2 or d2 + d3 == d1:
		count = count + 1
print(count)


def check_right(x1, y1, x2, y2, x3, y3):
	a = (y1 - y2) ** 2 + (x1 - x2) ** 2
	b = (y1 - y3) ** 2 + (x1 - x3) ** 2
	c = (y3 - y2) ** 2 + (x3 - x2) ** 2
	if a == b + c or b == c + a or c == a + b:
		return True
	else:
		return False
c = 0
for _ in range(int(input())):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	if check_right(x1, y1, x2, y2, x3, y3) == True:
		c += 1
print(c)


import math
n = int(input())
res = 0
for i in range(n):
	lst = list(map(int, input().split()))
	x = (lst[2] - lst[0]) ** 2 + (lst[3] - lst[1]) ** 2
	y = (lst[4] - lst[2]) ** 2 + (lst[5] - lst[3]) ** 2
	z = (lst[4] - lst[0]) ** 2 + (lst[5] - lst[1]) ** 2
	if x + y == z or x + z == y or y + z == x:
		res += 1
print(res)


import math
flag = 0
n = int(input())

def find():
	abc = 0
	a = abs(math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2))
	b = abs(math.sqrt((x2 - x3) ** 2 + (y2 - y3) ** 2))
	c = abs(math.sqrt((x3 - x1) ** 2 + (y3 - y1) ** 2))
	if b ** 2 == a ** 2 + c ** 2:
		abc = abc + 1
for t in range(0, n):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split(' '))
	if (y1 - y2) * (y3 - y2) == (x2 - x1) * (x3 - x2) or (y2 - y3) * (y1 - y3) == (x3 - x2) * (x1 - x3) or (y3 - y1) * (y2 - y1) == (x1 - x3) * (x2 - x1):
		flag += 1
print(flag)


count = 0
for _ in range(int(input())):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	P1P2 = (x1 - x2) ** 2 + (y1 - y2) ** 2
	P2P3 = (x3 - x2) ** 2 + (y3 - y2) ** 2
	P1P3 = (x3 - x1) ** 2 + (y3 - y1) ** 2
	if P1P2 + P2P3 == P1P3 or P1P2 + P1P3 == P2P3 or P1P3 + P2P3 == P1P2:
		count += 1
print(count)


ans = 0
for _ in range(int(input())):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	if (y1 - y2) * (y3 - y2) == (x2 - x1) * (x3 - x2) or (y2 - y3) * (y1 - y3) == (x3 - x2) * (x1 - x3) or (y3 - y1) * (y2 - y1) == (x1 - x3) * (x2 - x1):
		ans += 1
print(ans)


k = 0
for t in range(int(input())):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	if (y1 - y2) * (y3 - y2) == (x2 - x1) * (x3 - x2) or (y2 - y3) * (y1 - y3) == (x3 - x2) * (x1 - x3) or (y3 - y1) * (y2 - y1) == (x1 - x3) * (x2 - x1):
		k += 1
print(k)


from math import sqrt
n = int(input())
cnt = 0
for i in range(n):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	a = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)
	b = (x3 - x2) * (x3 - x2) + (y3 - y2) * (y3 - y2)
	c = (x1 - x3) * (x1 - x3) + (y1 - y3) * (y1 - y3)
	if c == a + b or b == a + c or a == b + c:
		cnt += 1
print(cnt)


n = int(input())
a = 0
for i in range(n):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	x = (y2 - y1) ** 2 + (x2 - x1) ** 2
	y = (y3 - y1) ** 2 + (x3 - x1) ** 2
	z = (y3 - y2) ** 2 + (x3 - x2) ** 2
	if x + y == z or x + z == y or y + z == x:
		a += 1
print(a)


def get_distance_squared(x1, y1, x2, y2):
	return (x2 - x1) ** 2 + (y2 - y1) ** 2
num_cases = int(input())
num_right_triangles = 0
for _ in range(num_cases):
	(x1, y1, x2, y2, x3, y3) = list(map(int, input().split()))
	line_12 = get_distance_squared(x1, y1, x2, y2)
	line_23 = get_distance_squared(x2, y2, x3, y3)
	line_31 = get_distance_squared(x3, y3, x1, y1)
	lengths_squared = sorted([line_12, line_23, line_31])
	if lengths_squared[2] == lengths_squared[0] + lengths_squared[1]:
		num_right_triangles += 1
print(num_right_triangles)


from math import sqrt

def get_distance(x1, y1, x2, y2):
	return sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
num_cases = int(input())
num_right_triangles = 0
for _ in range(num_cases):
	(x1, y1, x2, y2, x3, y3) = list(map(int, input().split()))
	line_12 = get_distance(x1, y1, x2, y2)
	line_23 = get_distance(x2, y2, x3, y3)
	line_31 = get_distance(x3, y3, x1, y1)
	lengths = sorted([line_12, line_23, line_31])
	if abs(lengths[-1] ** 2 - (lengths[0] ** 2 + lengths[1] ** 2)) < 0.01:
		num_right_triangles += 1
print(num_right_triangles)


co = 0
for i in range(int(input())):
	(a, b, c, d, e, f) = map(int, input().split())
	a_1 = (a - c) ** 2 + (b - d) ** 2
	b_1 = (c - e) ** 2 + (d - f) ** 2
	c_1 = (a - e) ** 2 + (b - f) ** 2
	if a_1 == b_1 + c_1 or b_1 == c_1 + a_1 or c_1 == b_1 + a_1:
		co += 1
print(co)


T = int(input())
cnt = 0
for i in range(T):
	(x1, y1, x2, y2, x3, y3) = list(map(int, input().split()))
	a = int(pow(x2 - x1, 2)) + int(pow(y2 - y1, 2))
	b = int(pow(x3 - x2, 2)) + int(pow(y3 - y2, 2))
	c = int(pow(x3 - x1, 2)) + int(pow(y3 - y1, 2))
	if (a > 0 and b > 0 and (c > 0)) and (c == a + b or a == b + c or b == a + c):
		cnt += 1
print(cnt)


N = int(input())
total = 0
for _ in range(N):
	A = list(map(int, input().split()))
	A = A + [A[0], A[1]]
	sides2 = []
	for i in range(0, 5, 2):
		a = A[i] - A[i + 2]
		b = A[i + 1] - A[i + 3]
		sides2.append(a * a + b * b)
	sides2.sort()
	if sides2[-1] == sum(sides2[:2]):
		total += 1
print(total)


T = int(input())
count = 0
for tc in range(T):
	(x1, y1, x2, y2, x3, y3) = list(map(int, input().split(' ')))
	d1 = (x2 - x1) ** 2 + (y2 - y1) ** 2
	d2 = (x3 - x2) ** 2 + (y3 - y2) ** 2
	d3 = (x3 - x1) ** 2 + (y3 - y1) ** 2
	l = [d1, d2, d3]
	l = sorted(l)
	if l[0] + l[1] == l[2]:
		count += 1
print(count)


n = input()
count = 0
for c in range(0, int(n)):
	(x1, y1, x2, y2, x3, y3) = list(map(int, input().split()))
	l1 = (x2 - x1) ** 2 + (y2 - y1) ** 2
	l2 = (x3 - x1) ** 2 + (y3 - y1) ** 2
	l3 = (x3 - x2) ** 2 + (y3 - y2) ** 2
	arr = []
	arr.append(l1)
	arr.append(l2)
	arr.append(l3)
	la = max(l1, l2, l3)
	arr.remove(la)
	if la == arr[0] + arr[1]:
		count = count + 1
print(count)


def square(x1, y1, x2, y2):
	return (x1 - x2) ** 2 + (y1 - y2) ** 2
t = int(input())
count = 0
for i in range(t):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	a1 = square(x1, y1, x2, y2)
	a2 = square(x2, y2, x3, y3)
	a3 = square(x3, y3, x1, y1)
	if 2 * max(a1, a2, a3) == a1 + a2 + a3:
		count += 1
print(count)


vishnesh = int(input())
s = 0
for i in range(vishnesh):
	(x1, y1, x2, y2, x3, y3) = list(map(int, input().split()))
	l1 = (x2 - x1) ** 2 + (y2 - y1) ** 2
	l2 = (x3 - x1) ** 2 + (y3 - y1) ** 2
	l3 = (x3 - x2) ** 2 + (y3 - y2) ** 2
	arr = []
	arr.append(l1)
	arr.append(l2)
	arr.append(l3)
	la = max(l1, l2, l3)
	arr.remove(la)
	if la == arr[0] + arr[1]:
		s = s + 1
print(s)


import math
t = int(input())
count = 0
for _ in range(t):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	d1 = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)
	d2 = (x1 - x3) * (x1 - x3) + (y1 - y3) * (y1 - y3)
	d3 = (x3 - x2) * (x3 - x2) + (y3 - y2) * (y3 - y2)
	if d1 > d2 and d1 > d3:
		if d1 == d2 + d3:
			count += 1
	elif d2 > d3 and d2 > d1:
		if d2 == d1 + d3:
			count += 1
	elif d3 == d1 + d2:
		count += 1
print(count)


ans = 0
for _ in range(int(input())):
	z = []
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	z.append((x1 - x2) ** 2 + (y1 - y2) ** 2)
	z.append((x2 - x3) ** 2 + (y2 - y3) ** 2)
	z.append((x1 - x3) ** 2 + (y1 - y3) ** 2)
	if sum(z) == 2 * max(z):
		ans += 1
print(ans)


tests = int(input())
count = 0
for i in range(tests):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	arr = []
	arr.append((x1 - x2) ** 2 + (y1 - y2) ** 2)
	arr.append((x2 - x3) ** 2 + (y2 - y3) ** 2)
	arr.append((x1 - x3) ** 2 + (y1 - y3) ** 2)
	if sum(arr) == 2 * max(arr):
		count += 1
print(count)


import math
cnt = 0
for _ in range(int(input())):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	A = (x2 - x1) ** 2 + (y2 - y1) ** 2
	B = (x2 - x3) ** 2 + (y2 - y3) ** 2
	C = (x3 - x1) ** 2 + (y3 - y1) ** 2
	if A == B + C or B == A + C or C == B + A:
		cnt += 1
print(cnt)


c = 0
for _ in range(int(input())):
	(a1, a2, b1, b2, c1, c2) = map(int, input().split())
	l = []
	l.append((b1 - a1) ** 2 + (b2 - a2) ** 2)
	l.append((c1 - b1) ** 2 + (c2 - b2) ** 2)
	l.append((a1 - c1) ** 2 + (a2 - c2) ** 2)
	if max(l) == sum(l) - max(l):
		c += 1
print(c)


t = int(input())
v = 0
for i in range(t):
	(a, b, c, d, e, f) = map(int, input().split())
	l = []
	g = ((c - a) ** 2 + (d - b) ** 2) ** 0.5
	h = ((e - a) ** 2 + (f - b) ** 2) ** 0.5
	j = ((e - c) ** 2 + (f - d) ** 2) ** 0.5
	l.append(g)
	l.append(h)
	l.append(j)
	l = sorted(l)
	i = l[0] * l[0]
	m = l[1] * l[1]
	n = l[2] * l[2]
	o = round(i + m)
	n = round(n)
	if o == n:
		v = v + 1
print(v)


N = int(input())
count = 0
for i in range(N):
	l = list(map(int, input().split()))
	A = (l[2] - l[0]) ** 2 + (l[3] - l[1]) ** 2
	B = (l[4] - l[2]) ** 2 + (l[5] - l[3]) ** 2
	C = (l[4] - l[0]) ** 2 + (l[5] - l[1]) ** 2
	if A + B == C:
		count += 1
	elif B + C == A:
		count += 1
	elif C + A == B:
		count += 1
print(count)


c = 0
for jj in range(int(input())):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	d1 = (x1 - x2) ** 2 + (y1 - y2) ** 2
	d2 = (x2 - x3) ** 2 + (y2 - y3) ** 2
	d3 = (x1 - x3) ** 2 + (y1 - y3) ** 2
	if d1 + d2 == d3 or d2 + d3 == d1 or d1 + d3 == d2:
		c += 1
print(c)


t = int(input())
c = 0
for _ in range(t):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	l1 = (x1 - x2) ** 2 + (y1 - y2) ** 2
	l2 = (x2 - x3) ** 2 + (y2 - y3) ** 2
	l3 = (x3 - x1) ** 2 + (y3 - y1) ** 2
	l = [l1, l2, l3]
	l.sort()
	if l[2] == l[0] + l[1]:
		c = c + 1
print(c)


count = 0
for _ in range(int(input())):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	l = [(x1 - x2) ** 2 + (y1 - y2) ** 2, (x2 - x3) ** 2 + (y2 - y3) ** 2, (x3 - x1) ** 2 + (y3 - y1) ** 2]
	l.sort()
	if l[2] == l[0] + l[1]:
		count = count + 1
print(count)


ans = 0
n = int(input())
for i in range(n):
	x = list(map(int, input().split()))
	a = (x[0] - x[2]) * (x[0] - x[2]) + (x[1] - x[3]) * (x[1] - x[3])
	b = (x[0] - x[4]) * (x[0] - x[4]) + (x[1] - x[5]) * (x[1] - x[5])
	c = (x[2] - x[4]) * (x[2] - x[4]) + (x[3] - x[5]) * (x[3] - x[5])
	if a + b == c or a + c == b or b + c == a:
		ans += 1
print(ans)


T = int(input())
ct = 0
for t in range(T):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	d1 = pow(x1 - x2, 2) + pow(y1 - y2, 2)
	d2 = pow(x3 - x2, 2) + pow(y3 - y2, 2)
	d3 = pow(x1 - x3, 2) + pow(y1 - y3, 2)
	if d1 > d2 and d1 > d3:
		if d1 == d2 + d3:
			ct += 1
	elif d2 > d1 and d2 > d3:
		if d2 == d1 + d3:
			ct += 1
	elif d3 == d1 + d2:
		ct += 1
print(ct)


N = int(input())
count = 0
for i in range(N):
	v = list(map(int, input().split()))
	l1 = (v[2] - v[0]) ** 2 + (v[3] - v[1]) ** 2
	l2 = (v[4] - v[2]) ** 2 + (v[5] - v[3]) ** 2
	l3 = (v[4] - v[0]) ** 2 + (v[5] - v[1]) ** 2
	if l1 + l2 == l3:
		count += 1
	elif l2 + l3 == l1:
		count += 1
	elif l3 + l1 == l2:
		count += 1
print(count)


t = int(input())
count = 0
for j in range(t):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	a = (x2 - x1) ** 2 + (y2 - y1) ** 2
	b = (x3 - x2) ** 2 + (y3 - y2) ** 2
	c = (x3 - x1) ** 2 + (y3 - y1) ** 2
	if a > b and a > c and (a == b + c):
		count += 1
	elif b > c and b > a and (b == c + a):
		count += 1
	elif c > a and c > b and (c == a + b):
		count += 1
print(count)


a = 0
for _ in range(int(input())):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	d1 = pow(x1 - x3, 2) + pow(y1 - y3, 2)
	d2 = pow(x3 - x2, 2) + pow(y3 - y2, 2)
	d3 = pow(x2 - x1, 2) + pow(y2 - y1, 2)
	if max(d1, d2, d3) == d1 + d2 + d3 - max(d1, d2, d3):
		a += 1
print(a)


n = int(input())
count = 0
for i in range(n):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	part_1 = (x1 - x2) ** 2 + (y1 - y2) ** 2
	part_2 = (x2 - x3) ** 2 + (y2 - y3) ** 2
	part_3 = (x1 - x3) ** 2 + (y1 - y3) ** 2
	if part_1 == part_2 + part_3 or part_2 == part_1 + part_3 or part_3 == part_1 + part_2:
		count += 1
print(count)


count = 0
for x in range(int(input())):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	a2 = (x1 - x2) ** 2 + (y1 - y2) ** 2
	b2 = (x2 - x3) ** 2 + (y2 - y3) ** 2
	c2 = (x3 - x1) ** 2 + (y3 - y1) ** 2
	if a2 == b2 + c2 or b2 == c2 + a2 or c2 == a2 + b2:
		count += 1
print(count)


import numpy as np

def solve(p1, p2, p3):
	a = np.array(p1)
	b = np.array(p2)
	c = np.array(p3)
	if any([(b - a).dot(c - b) == 0, (c - b).dot(c - a) == 0, (b - a).dot(c - a) == 0]):
		return 1
	else:
		return 0

def do_codechef():
	ans = 0
	for t in range(int(input())):
		(x1, y1, x2, y2, x3, y3) = map(int, input().split(' '))
		ans += solve([x1, y1], [x2, y2], [x3, y3])
	print(ans)
do_codechef()
exit()


ry = 0
for i in range(int(input())):
	(xx, yy, pp, oo, uu, rr) = map(int, input().split())
	bro = pow(xx - pp, 2) + pow(yy - oo, 2)
	sis = pow(uu - pp, 2) + pow(rr - oo, 2)
	chat = pow(xx - uu, 2) + pow(yy - rr, 2)
	rea = [bro, sis, chat]
	rea.sort()
	if rea[2] == rea[1] + rea[0]:
		ry += 1
print(ry)


def get_dist(a, b, c, d):
	return (a - c) ** 2 + (b - d) ** 2
test_case = int(input())
count = 0
for _ in range(test_case):
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	a = int(get_dist(x1, y1, x2, y2))
	b = int(get_dist(x1, y1, x3, y3))
	c = int(get_dist(x2, y2, x3, y3))
	if a + b == c or a + c == b or b + c == a:
		count += 1
print(count)


c = 0
for i in range(int(input())):
	(X1, Y1, X2, Y2, X3, Y3) = map(int, input().split())
	A = int(pow(X2 - X1, 2)) + int(pow(Y2 - Y1, 2))
	B = int(pow(X3 - X2, 2)) + int(pow(Y3 - Y2, 2))
	C = int(pow(X3 - X1, 2)) + int(pow(Y3 - Y1, 2))
	if (A > 0 and B > 0 and (C > 0)) and (A == B + C or B == A + C or C == A + B):
		c += 1
print(c)


ans = 0
for _ in range(int(input())):
	a = list(map(int, input().split()))
	d1 = (a[0] - a[2]) * (a[0] - a[2]) + (a[1] - a[3]) * (a[1] - a[3])
	d2 = (a[0] - a[4]) * (a[0] - a[4]) + (a[1] - a[5]) * (a[1] - a[5])
	d3 = (a[2] - a[4]) * (a[2] - a[4]) + (a[3] - a[5]) * (a[3] - a[5])
	if d1 + d2 == d3 or d1 + d3 == d2 or d2 + d3 == d1:
		ans += 1
print(ans)