#include <iostream> #include <fstream> #include <map> #include <set> using namespace std; typedef pair<int,int> ang; bool ang_less(const ang &a,const ang &b) { return a.second*b.first>=a.first*b.second; } int main() { ifstream cin("squares.txt"); for (int n;cin>>n,n!=0;){ set<ang> a; multimap<int,pair<int,pair<ang,ang> > > m; for (int i=0;i<n;i++){ int x,y,l;cin>>x>>y>>l; m.insert(make_pair(x+y+l,make_pair(i,make_pair(ang(x,y+l),ang(x+l,y))))); a.insert(ang(x,y+l)); a.insert(ang(x+l,y)); } set<int> view; set<ang>::iterator p1=a.begin(); set<ang>::iterator p2=a.begin();p2++; while((++p2)!=a.end()){ ang a1=*p1; ang a2=*p2; ang aa=ang(a1.first*a2.second+a1.second*a2.first,2*a1.second*a2.second); for (multimap<int,pair<int,pair<ang,ang> > >::iterator q=m.begin(); q!=m.end();q++){ if (ang_less(q->second.second.first,aa)&& ang_less(aa,q->second.second.second)){ view.insert(q->second.first); break; } } } cout<<view.size()<<endl; } return 0; }