//万湖之国的形成
#include <iostream>
#include <algorithm>
using namespace std;
struct hole{
double x;
double y;
double r;
};
hole all[100005];
int pre[100005];
bool cmp(hole a,hole b)//排序一下可以大大提升计算速度
{
return a.x-a.r<b.x-b.r;
}
bool check(hole a,hole b)//检查两个坑是否相交
{
double distance=(a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
if(distance<(a.r+b.r)*(a.r+b.r))
return true;
return false;
}
int find(int x) //查找结点 x的根结点
{
if(pre[x] == x) return x; //递归出口:x的上级为 x本身,即 x为根结点
return pre[x] = find(pre[x]); //此代码相当于先找到根结点 rootx,然后pre[x]=rootx
}
int main()
{
int n;
scanf("%d",&n);
int res=n;
for(int i=1;i<=n;i++)
{
scanf("%lf%lf%lf",&all[i].x,&all[i].y,&all[i].r);
pre[i]=i;
}
sort(all+1,all+1+n,cmp);//标记v数组没必要改 因为还是一个一个点
for(int i=1;i<=n;i++)
{
for(int j=i+1;j<=n;j++)
{
if(all[j].x-all[j].r>=all[i].x+all[i].r)
break;
if(check(all[i],all[j]))
{
int pi=find(i);
int pj=find(j);
if(pi!=pj)
{
res--;
pre[pi]=pj;
}
}
}
}
printf("%d\n",res);
return 0;
}
//繁忙的公路
#include<iostream>
#define lowbit(x) (x&(-x))
typedef long long ll;
using namespace std;
int c[2000006];
int n,m;
ll ans;
void add_dandian(int x,int k)
{
for(int i=x;i<=n;i+=lowbit(i))
c[i]+=k;
}
void search(int begin,int end)
{
for(int i=end;i;i-=lowbit(i))
ans+=c[i];
for(int i=begin-1;i;i-=lowbit(i))
ans-=c[i];
}
int main()
{
scanf("%d\n%d\n",&n,&m);
while(m--)
{
char choice;
int x,y;
scanf("%c %d %d\n",&choice,&x,&y);
//printf("%c %d %d\n",choice,x,y);
if(choice=='H')
add_dandian(x,y);
else if(choice=='Q')
{
ans=0;
search(x,y);
printf("%lld\n",ans);
}
}
return 0;
}