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 <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<(x)<<endl
#define fi first
#define se second

#define INF 2147483600

#define EPS 1e-12

// ???????°???°???????????????
inline double add(double a, double b){
  if(abs(a+b) < EPS*(abs(a) + abs(b))) return 0;
  return a+b;
}

struct Point{
  double x,y;
  Point() {}
  Point(double nx, double ny) : x(nx), y(ny) {}
  Point operator + (const Point & p){ return Point(add(x, p.x), add(y, p.y)); }
  Point operator - (const Point & p){ return Point(add(x,-p.x), add(y,-p.y)); }
  Point operator * (double d){ return Point(x*d, y*d); }
  double dot(const Point & p){ return add(x * p.x, y*p.y); }  //??????
  double det(const Point & p){ return add(x * p.y, -y*p.x); } //??????
  double dist(const Point & p){ return sqrt((x-p.x)*(x-p.x) + (y-p.y)*(y-p.y)); }
  bool operator < (const Point & p) const {
    if(x != p.x) return x < p.x;
    else return y < p.y;
  }
};


int main(){
  int n;
  while(cin>>n, n){
    vector<pair<Point, double> > vec(n); //first:??????, second:??????
    rep(i,n) scanf("%lf %lf %lf", &(vec[i].fi.x), &(vec[i].fi.y), &(vec[i].se));

    vector<pair<Point, pair<int, int> > > inter; // ???????????????

    int ans=0;
    // i???????????????????????????????????????
    // O(n)????????????????????????O(n^3) -> ??¨???O(n^4)
    for(int i=n-1; i>=0; i--){

      // ?????????????????????????????¨??????????????????
      for(int j=i+1; j<n; j++) if( (vec[i].se + vec[j].se) - vec[i].fi.dist(vec[j].fi) > 0 && vec[i].fi.dist(vec[j].fi) - abs(vec[i].se - vec[j].se) > 0){
        // ????????????????????????????????´?????? Ax + By + C = 0 ??¨??????
        double A = 2*(vec[i].fi.x - vec[j].fi.x);
        double B = 2*(vec[i].fi.y - vec[j].fi.y);
        double C = - vec[i].fi.x*vec[i].fi.x + vec[j].fi.x*vec[j].fi.x
                   - vec[i].fi.y*vec[i].fi.y + vec[j].fi.y*vec[j].fi.y
                   + vec[i].se  *vec[i].se   - vec[j].se  *vec[j].se;

        // ?????¨??´????????????
        if(abs(B) < EPS){ // y??§?¨???????????????´???
          double x = vec[i].fi.x; double y = vec[i].fi.y; double r = vec[i].se;
          double rt = sqrt(r*r - (C/A+x)*(C/A+x)); assert(r >= abs(C/A+x));
          inter.pb(mp(Point(-C/A, y+rt), mp(i,j)));
          inter.pb(mp(Point(-C/A, y-rt), mp(i,j)));
        } else {
          double x = vec[i].fi.x; double y = vec[i].fi.y; double r = vec[i].se;
          double a = A*A + B*B;
          double b = A*C + A*B*y - B*B*x;
          double c = B*B*x*x + (C+B*y)*(C+B*y) - B*B*r*r;
          assert(b*b - a*c >= 0);
          double rt = sqrt(b*b - a*c);
          double x1 = (-b + rt)/a; double x2 = (-b - rt)/a;

          inter.pb(mp(Point(x1, (-A*x1-C)/B), mp(i,j)));
          inter.pb(mp(Point(x2, (-A*x2-C)/B), mp(i,j)));
        }
      }

      bool isSeen=true;
      for(int j=i+1; j<n; j++){ // ?????????????????????????????¨???????????????????????´???
        if( (vec[j].se - vec[i].se) - vec[i].fi.dist(vec[j].fi) > EPS ){
          isSeen=false;
          break;
        }
      }

      if(isSeen && inter.size()>0){
        // ??????????????????????????¨?¢???£?????????????????????????????°??????????????????????????????????????????
        // O(n^3) : O(n^2)????????????????????????O(n)?????????????????¨??????????????????????¢??????????
        for(auto po : inter){
          auto p = po.fi;
          if( p.dist(vec[i].fi) - vec[i].se > EPS) continue; // ?????????

          isSeen=false;
          bool flg=true;
          for(int j=i+1; j<n; j++) if(vec[j].se - p.dist(vec[j].fi) > EPS){ // ?¢???£?????????
            if( i==po.se.fi && j==po.se.se ) continue; // ?????????????????¨???2???. i<j
            flg=false;
            break;
          }
          if(flg){ // ?????????????????????????????????
            isSeen=true;
            break;
          }
        }
      }
      if(isSeen) ans++;
    }
    cout<<ans<<endl;
  }

  return 0;
}