934_E. A Colourful Prospect_9737
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>
#include <bits/stdc++.h>
using namespace std;
const double eps = 0.00000001;
struct punct {
  double x, y;
  punct() {}
  punct(double x1, double y1) {
    x = x1;
    y = y1;
  }
  bool operator<(const punct &aux) const {
    if (abs(x - aux.x) > eps) return x < aux.x;
    if (abs(y - aux.y) > eps) return y < aux.y;
    return false;
  }
  bool operator==(const punct &aux) const {
    return (abs(x - aux.x) < eps && abs(y - aux.y) < eps);
  }
} point[10010], centru;
struct cerc {
  double x, y, r;
  bool operator<(const cerc &aux) const {
    if (abs(x - aux.x) > eps) return x < aux.x;
    if (abs(y - aux.y) > eps) return y < aux.y;
    if (abs(r - aux.r) > eps) return r < aux.r;
    return false;
  }
  bool operator==(const cerc &aux) const {
    return (abs(x - aux.x) < eps && abs(y - aux.y) < eps &&
            abs(r - aux.r) < eps);
  }
} circle[210];
set<int> v[10010];
int noduri, muchii;
char vaz[10010];
vector<punct> intersectcircles(cerc c1, cerc c2) {
  vector<punct> sol;
  double d =
      sqrt((c1.x - c2.x) * (c1.x - c2.x) + (c1.y - c2.y) * (c1.y - c2.y));
  if (d < abs(c1.r - c2.r) || c1.r + c2.r < d || abs(d) < eps) return sol;
  double a = (c1.r * c1.r - c2.r * c2.r + d * d) / (2 * d);
  double h = sqrt(c1.r * c1.r - a * a);
  punct p = punct(c1.x + a * (c2.x - c1.x) / d, c1.y + a * (c2.y - c1.y) / d);
  sol.push_back(
      punct(p.x + h * (c2.y - c1.y) / d, p.y - h * (c2.x - c1.x) / d));
  sol.push_back(
      punct(p.x - h * (c2.y - c1.y) / d, p.y + h * (c2.x - c1.x) / d));
  return sol;
}
int pecerc(cerc c, punct p) {
  return abs((p.x - c.x) * (p.x - c.x) + (p.y - c.y) * (p.y - c.y) -
             c.r * c.r) < eps;
}
int compare(int a, int b) {
  return atan2(point[a].y - centru.y, point[a].x - centru.x) <
         atan2(point[b].y - centru.y, point[b].x - centru.x);
}
void dfs(int nod) {
  vaz[nod] = 1;
  noduri++;
  muchii += v[nod].size();
  for (set<int>::iterator it = v[nod].begin(); it != v[nod].end(); it++)
    if (!vaz[*it]) dfs(*it);
}
int main() {
  int n, nr = 0, nregiuni = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    scanf("%lf%lf%lf", &circle[i].x, &circle[i].y, &circle[i].r);
  sort(circle + 1, circle + 1 + n);
  int x = 1;
  for (int i = 2; i <= n; i++)
    if (!(circle[i] == circle[i - 1])) circle[++x] = circle[i];
  n = x;
  for (int i = 1; i < n; i++)
    for (int j = i + 1; j <= n; j++) {
      vector<punct> intpoints = intersectcircles(circle[i], circle[j]);
      for (int q = 0; q < intpoints.size(); q++) point[++nr] = intpoints[q];
    }
  sort(point + 1, point + 1 + nr);
  x = 1;
  for (int i = 2; i <= nr; i++)
    if (!(point[i] == point[i - 1])) point[++x] = point[i];
  nr = x;
  for (int i = 1; i <= n; i++) {
    vector<int> oncircle;
    for (int j = 1; j <= nr; j++)
      if (pecerc(circle[i], point[j])) oncircle.push_back(j);
    if (oncircle.size() < 2)
      nregiuni++;
    else {
      centru = punct(circle[i].x, circle[i].y);
      sort(oncircle.begin(), oncircle.end(), compare);
      oncircle.push_back(oncircle[0]);
      for (int j = 0; j < oncircle.size() - 1; j++) {
        int a = oncircle[j], b = oncircle[j + 1];
        if (v[a].find(b) != v[a].end() || v[b].find(a) != v[b].end())
          nregiuni++;
        v[a].insert(b);
        v[b].insert(a);
      }
    }
  }
  for (int i = 1; i <= nr; i++)
    if (!vaz[i]) {
      noduri = muchii = 0;
      dfs(i);
      muchii /= 2;
      nregiuni += 2 - noduri + muchii - 1;
    }
  printf("%d", nregiuni + 1);
  return 0;
}

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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