Problem: Do you know confetti? They are small discs of colored paper, and people throw them around during parties or festivals. Since people throw lots of confetti, they may end up stacked one on another, so there may be hidden ones underneath.

A handful of various sized confetti have been dropped on a table. Given their positions and sizes, can you tell us how many of them you can see?

The following figure represents the disc configuration for the first sample input, where the bottom disc is still visible.

<image>



Input

The input is composed of a number of configurations of the following form.


n 		
x1 y1 z1
x2 y2 z2
.
.
.
xn yn zn


The first line in a configuration is the number of discs in the configuration (a positive integer not more than 100), followed by one Ine descriptions of each disc: coordinates of its center and radius, expressed as real numbers in decimal notation, with up to 12 digits after the decimal point. The imprecision margin is ±5 × 10-13. That is, it is guaranteed that variations of less than ±5 × 10-13 on input values do not change which discs are visible. Coordinates of all points contained in discs are between -10 and 10.

Confetti are listed in their stacking order, x1 y1 r1 being the bottom one and xn yn rn the top one. You are observing from the top.

The end of the input is marked by a zero on a single line.

Output

For each configuration you should output the number of visible confetti on a single line.

Example

Input

3
0 0 0.5
-0.9 0 1.00000000001
0.9 0 1.00000000001
5
0 1 0.5
1 1 1.00000000001
0 2 1.00000000001
-1 1 1.00000000001
0 -0.00001 1.00000000001
5
0 1 0.5
1 1 1.00000000001
0 2 1.00000000001
-1 1 1.00000000001
0 0 1.00000000001
2
0 0 1.0000001
0 0 1
2
0 0 1
0.00000001 0 1
0


Output

3
5
4
2
2

Solution (in CPP):

Solution:
#include<iostream>
#include<cfloat>
#include<cassert>
#include<cmath>
#include<cstdio>
#include<vector>
#include<set>
#include<algorithm>

using namespace std;

#define EPS (1e-15)
#define equals(a, b) (fabs((a) - (b)) < EPS )
#define dle(a, b) (equals(a, b) || a < b )
static const double PI = acos(-1);

class Point{
public:
  double x, y;

  Point ( double x = 0, double y = 0): x(x), y(y){}

  Point operator + ( Point p ){ return Point(x + p.x, y + p.y); }
  Point operator - ( Point p ){ return Point(x - p.x, y - p.y); }
  Point operator * ( double a ){ return Point(x*a, y*a); }
  Point operator / ( double a ){ return Point(x/a, y/a); }
  Point operator / ( Point p ) { return Point((x*p.x+y*p.y)/(p.x*p.x+p.y*p.y), (y*p.x-x*p.y)/(p.x*p.x+p.y*p.y)); }
   
  double abs() { return sqrt(norm());}
  double norm() { return x*x + y*y; }

  bool operator < ( const Point &p ) const {
    return x != p.x ? x < p.x : y < p.y;
  }

  bool operator == ( const Point &p ) const {
    return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
  }
};

typedef Point Vector;


class Segment{
public:
  Point p1, p2;
  Segment(Point s = Point(), Point t = Point()): p1(s), p2(t){}

};

typedef Segment Line;

static const int CIRCLE_NON = 0;
static const int CIRCLE_OUT = 1;
static const int CIRCLE_IN = 2;
static const int CIRCLE_CROSS = 3;

class Circle{
public:
  Point c;
  double r;
  Circle(Point c = Point(), double r = 0.0): c(c), r(r){}
};

double norm( Vector a ){ return a.x*a.x + a.y*a.y; }
double abs( Vector a ){ return sqrt(norm(a)); }
Point polar( double a, double r ){ return Point(cos(r)*a, sin(r)*a);}
double getDistance( Vector a, Vector b ){ return abs(a - b); }
double dot( Vector a, Vector b ){ return a.x*b.x + a.y*b.y; }
double cross( Vector a, Vector b ){ return a.x*b.y - a.y*b.x; }

Point project( Segment s, Point p ){
  Vector base = s.p2 - s.p1;
  double t = dot(p - s.p1, base)/norm(base);
  return s.p1 + base*t;
}

double getAngle(Point p){
  double polar = atan2(p.y, p.x);
  return (dle(0, polar))? polar : 2.0*acos(-1)+polar;
}

int isIntersect(Circle c1, Circle c2){
  double d = abs(c1.c - c2.c);
  if ( c1.r + c2.r < d ) return CIRCLE_NON; // no overlap
  if ( d + c2.r < c1.r ) return CIRCLE_IN;  // c1 includes c2
  if ( d + c1.r < c2.r ) return CIRCLE_OUT;  // c2 includes c1
  return CIRCLE_CROSS;
}

double getDistanceLP(Line s, Point p){
  return abs(cross(s.p2 - s.p1, p - s.p1)/abs(s.p2 - s.p1));
}

double arg(Vector p){
  return atan2(p.y, p.x);
}

pair<Point, Point> getCrossPoints(Circle c1, Circle c2){
  assert( isIntersect( c1, c2 ) );
  double d = abs(c1.c - c2.c);
  double a = acos((c1.r*c1.r+d*d-c2.r*c2.r)/(2*c1.r*d));
  double t = arg(c2.c - c1.c);
  return make_pair(c1.c+polar(c1.r, t+a), c1.c+polar(c1.r, t-a));
}

bool isIntersect( Circle c1, Line l ){
  double d = getDistanceLP(l, c1.c);
  return ( equals(d, c1.r) || d < c1.r );
}

pair<Point, Point> getCrossPoints(Circle c, Line l ){
  assert( isIntersect( c, l ) );
  Vector pr = project(l, c.c);
  Vector e = (l.p2 - l.p1)/abs(l.p2 - l.p1);
  double base = sqrt(c.r*c.r - norm(pr-c.c));
  return make_pair(pr + e*base, pr - e*base);
}

Circle C[100];
int n;

void compute(){
  vector<Point> candidates;
  vector<double> Y;  

  Y.push_back(-100.0);
  Y.push_back(100.0);

  for ( int i = 0; i < n; i++ ){
    Y.push_back(C[i].c.y - C[i].r);
    Y.push_back(C[i].c.y + C[i].r);
  }
  
  for ( int i = 0; i < n-1; i++ ){
    for ( int j = i+1; j < n; j++ ){
      if ( isIntersect(C[i], C[j]) != CIRCLE_CROSS ) continue;
      pair<Point, Point> pp = getCrossPoints(C[i], C[j]);
      Y.push_back(pp.first.y);
      Y.push_back(pp.second.y);
    }
  }

  sort(Y.begin(), Y.end());

  for ( int k = 0; k < Y.size()-1; k++ ){
    double my = (Y[k+1] + Y[k])/2;
    Line l = Line(Point(-100, my), Point(100, my));
    vector<double> X;
    X.push_back(-100);
    X.push_back(100);
    for ( int i = 0; i < n; i++ ){
      if ( !isIntersect(C[i], l) ) continue;
      pair<Point, Point> pp = getCrossPoints(C[i], l);
      X.push_back(pp.first.x);
      X.push_back(pp.second.x);
    }
    sort(X.begin(), X.end());

    for ( int i = 0; i < X.size()-1; i++ ){
      candidates.push_back(Point((X[i+1]+X[i])/2, my));
    }
  }

  int ans = 0;
  for ( int i = 0; i < n; i++ ){
    for ( int c = 0; c < candidates.size(); c++ ){
      Point t = candidates[c];
      bool f = true;
      if ( abs(C[i].c - t) > C[i].r ) {
	continue;
      }
      for ( int j = i+1; j < n; j++ ){
	if ( dle(abs(C[j].c - t), C[j].r) ) {
	  f = false;
	  break;
	}
      }
      if ( f ) {
	ans++;
	break;
      }
    }
  }

  printf("%d\n", ans);
}

int main(){
  double x, y, r;
  while(1){
    cin >> n;
    if ( n == 0 ) break;
    for ( int i = 0; i < n; i++ ){
      cin >> x >> y >> r; C[i] = Circle( Point(x, y), r);
    }
    compute();
  }

  return 0;
}