#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;
}

Measured memory_bytes: 3272