934_E. A Colourful Prospect_9736
Firecrackers scare Nian the monster, but they're wayyyyy too noisy! Maybe fireworks make a nice complement.

Little Tommy is watching a firework show. As circular shapes spread across the sky, a splendid view unfolds on the night of Lunar New Year's eve.

A wonder strikes Tommy. How many regions are formed by the circles on the sky? We consider the sky as a flat plane. A region is a connected part of the plane with positive area, whose bound consists of parts of bounds of the circles and is a curve or several curves without self-intersections, and that does not contain any curve other than its boundaries. Note that exactly one of the regions extends infinitely.

Input

The first line of input contains one integer n (1 ≤ n ≤ 3), denoting the number of circles.

The following n lines each contains three space-separated integers x, y and r ( - 10 ≤ x, y ≤ 10, 1 ≤ r ≤ 10), describing a circle whose center is (x, y) and the radius is r. No two circles have the same x, y and r at the same time.

Output

Print a single integer — the number of regions on the plane.

Examples

Input

3
0 0 1
2 0 1
4 0 1


Output

4


Input

3
0 0 2
3 0 2
6 0 2


Output

6


Input

3
0 0 2
2 0 2
1 1 2


Output

8

Note

For the first example,

<image>

For the second example,

<image>

For the third example,

<image>
from math import sqrt

class vector:
	def __init__(self, _x = 0, _y = 0):
		self.x = _x
		self.y = _y
	def len(self):
		return sqrt(self.x ** 2 + self.y ** 2)
	def len_sq(self):
		return self.x ** 2 + self.y ** 2
	def __mul__(self, other):
		if (type(self) == type(other)):
			return self.x * other.x + self.y * other.y
		return vector(self.x * other, self.y * other)
	def __mod__(self, other):
		return self.x * other.y - self.y * other.x
	def normed(self):
		length = self.len()
		return vector(self.x / length, self.y / length)
	def normate(self):
		self = self.normed()
	def __str__(self):
		return "(" + str(self.x) + ", " + str(self.y) + ")"
	def __add__(self, other):
		return vector(self.x + other.x, self.y + other.y);
	def __sub__(self, other):
		return vector(self.x - other.x, self.y - other.y);
	def __eq__(self, other):
		return self.x == other.x and self.y == other.y
	def rot(self):
		return vector(self.y, -self.x)

class line:
	def __init__(self, a = 0, b = 0, c = 0):
		self.a = a
		self.b = b
		self.c = c
	def intersect(self, other):
		d = self.a * other.b - self.b * other.a
		dx = self.c * other.b - self.b * other.c
		dy = self.a * other.c - self.c * other.a
		return vector(dx / d, dy / d)
	def fake(self, other):
		d = self.a * other.b - self.b * other.a
		return d
	def __str__(self):
		return str(self.a) + "*x + " + str(self.b) + "*y = " + str(self.c) 

def line_pt(A, B):
		d = (A - B).rot()
		return line(d.x, d.y, d * A)

class circle:
	def __init__(self, O = vector(0, 0), r = 0):
		self.O = O
		self.r = r
	def intersect(self, other):
		O1 = self.O
		O2 = other.O
		r1 = self.r
		r2 = other.r
		if (O1 == O2):
			return []
		if ((O1 - O2).len_sq() > r1 ** 2 + r2 ** 2 + 2 * r1 * r2):
			return []
		rad_line = line(2 * (O2.x - O1.x), 2 * (O2.y - O1.y), r1 ** 2 - O1.len_sq() - r2 ** 2 + O2.len_sq())
		central = line_pt(O1, O2)
		M = rad_line.intersect(central)
		if ((O1 - O2).len_sq() == r1 ** 2 + r2 ** 2 + 2 * r1 * r2):
			return [M]
		d = (O2 - O1).normed().rot()
		if (r1 ** 2 - (O1 - M).len_sq() < 0):
			return []
		d = d * (sqrt(r1 ** 2 - (O1 - M).len_sq()))
		return [M + d, M - d]
	def fake(self, other):
		O1 = self.O
		O2 = other.O
		r1 = self.r
		r2 = other.r
		if (O1 == O2):
			return 1
		if ((O1 - O2).len_sq() > r1 ** 2 + r2 ** 2 + 2 * r1 * r2):
			return 1
		rad_line = line(2 * (O2.x - O1.x), 2 * (O2.y - O1.y), r1 ** 2 - O1.len_sq() - r2 ** 2 + O2.len_sq())
		central = line_pt(O1, O2)
		return rad_line.fake(central)
n = input()
arr = []
m = 1
for i in range(n):
	x, y, r = map(int, raw_input().split())
	arr.append(circle(vector(x, y), r))
for i in range(n):
	for j in range(i + 1, n):
		m *= arr[i].fake(arr[j])
for i in range(n):
	arr[i].O = arr[i].O * m
	arr[i].r = arr[i].r * m
s = set()
V = 0
for i in range(n):
	for j in range(i + 1, n):
		tmp = arr[i].intersect(arr[j])
		for e in tmp:
			s.add((round(e.x, 6), round(e.y, 6)))
V += len(s)
E = 0

par = [i for i in range(n)]

def get_par(v):
	if (par[v] != v):
		par[v] = get_par(par[v])
	return par[v]
def unite(v, u):
	par[get_par(v)] = get_par(u)
for i in range(n):
	s = set()
	for j in range(n):	
		tmp = arr[i].intersect(arr[j])
		if (len(tmp)):
			unite(i, j)
		for e in tmp:
			s.add((round(e.x, 	), round(e.y, 	)))
	E += len(s)
print(E - V + 1 + len({get_par(i) for i in range(n)}))
3
0 0 2
2 0 2
1 1 2
 3
0 0 1
2 0 1
4 0 1
 3
0 0 2
3 0 2
6 0 2
 3
2 5 4
-6 -6 7
1 6 6
 3
0 0 2
0 0 4
3 0 2
 3
5 -4 1
3 -5 5
-3 3 5
 3
3 4 5
-3 4 5
0 -5 5
 3
-4 -1 2
-6 -5 10
1 3 1
 1
0 0 10
 3
-10 4 10
10 4 10
0 -7 10
 3
0 0 2
1 0 1
-1 0 1
 3
2 4 4
3 -6 4
-4 -4 6
 3
2 -2 5
2 0 3
2 -1 4
 3
4 0 1
-1 1 9
0 3 6
 3
0 -5 2
-6 3 2
-3 -1 3
 3
0 0 1
0 3 2
4 0 3
 3
-6 -2 7
5 0 2
2 4 3
 3
2 0 2
4 0 4
0 -4 5
 3
-4 1 5
-7 7 10
-3 -4 8
 3
-5 -2 10
3 -1 3
-1 1 5
 3
-6 2 1
0 -6 9
-5 -3 2
 3
2 0 2
4 0 4
0 -4 3
 3
-6 5 2
-6 -1 4
2 5 6
 3
-3 -4 2
-6 -2 2
0 0 3
 3
-4 0 6
-3 -6 6
4 6 4
 3
-2 0 2
1 4 3
-6 3 3
 3
-3 -1 8
0 3 3
2 2 2
 3
2 0 2
4 0 4
0 -4 4
 2
-10 10 1
10 -10 1
 3
-2 -5 4
-5 -1 5
-6 -2 9
 3
-6 -6 9
6 -4 1
-3 -2 8
 3
5 2 4
-3 6 4
-6 -6 10
 3
-2 -3 5
-6 1 7
5 4 5
 3
1 -5 1
4 -3 3
-6 -6 10
 3
-2 0 2
2 0 2
0 0 4
 3
0 0 6
-4 -3 1
-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