The Gorelians are a warlike race who roam the universe conquering worlds for sport. Their space battles are usually one-sided, but every so often even the Gorelians lose badly. During one such defeat a Gorelian ship was so damaged that its crew had to evacuate to the planet below. Because the escape pods are imprecise, the Gorelians were scattered across a wide area (small enough, though, that we can treat the planetary surface as a flat plane). Your job is to track their attempt to regroup.
Every escape pod carries a locator that reports the Gorelian's coordinates and a radio for contacting other Gorelians. The radio's range depends on how much power it has.
When a Gorelian lands he checks his radio to see whether he can reach anyone. If he can, everyone he can reach agrees on a meeting point and converges there. Once together they combine their radios into a single, more powerful one and try again. This repeats until no one else can be reached.
Who can talk. Two parties can communicate as long as at least one of them has a radio whose range covers the distance between them. For example, if Alice's range is 40 and Bob's is 30 but they are 45 apart, neither radio reaches the other, so they cannot talk. If instead they are 35 apart, Alice's radio still reaches Bob even though Bob's does not reach Alice, so they can talk.
Where they meet. When several parties can reach one another they meet at the average of their current positions. Each party counts as a single point regardless of how many Gorelians it already contains. (So a group of three sitting at one location and a lone Gorelian meet at the midpoint of those two points, not at a headcount-weighted average.)
Combining radios. The area covered by the combined radio equals the sum of the areas of the radios being combined. A range $r$ covers area $\pi r^2$, so combining ranges $r_1, r_2, \dots, r_k$ yields a new range $r = \sqrt{r_1^2 + r_2^2 + \dots + r_k^2}$. For example, Alice (range 40, area $1600\pi$) and Bob (range 30, area $900\pi$) combine to area $2500\pi$, i.e. range 50.
Worked example. Suppose Alice $(100,100)$, Bob $(130,80)$, Cathy $(80,60)$, and Dave $(120,150)$ have all landed, each with range 30. None of them can reach anyone else. Now Eddy lands at $(90,80)$, also with range 30. Eddy can reach Alice and Cathy, so the three meet at their average $(90,80)$ and combine to range $\sqrt{2700}\approx 51.96$. With the new range they can now reach Bob, so they meet Bob at $(110,80)$ and combine to range $\sqrt{3600}=60$. That is still not enough to reach Dave, so Dave stays by himself. Two groups remain.
Gorelians land in the order given in the input. When a Gorelian lands, his group merges with everyone it can reach, repeating until no further merge is possible; only then does the next Gorelian land. Use double-precision arithmetic for every computation, because after a merge the positions and ranges are generally no longer integers.
The input contains one or more datasets. Each dataset starts with a line containing an integer $N$, the number of Gorelians in that dataset ($1 \le N \le 100$). A line with $N = 0$ marks the end of the input and is not processed.
The next $N$ lines each contain three integers $X$, $Y$, and $R$: the coordinates where a Gorelian lands and the range of his radio, with $0 \le X \le 1000$, $0 \le Y \le 1000$, and $1 \le R \le 1000$. Only these initial values are guaranteed to be integers; values produced by merging need not be. The Gorelians land in the order listed.
For each dataset, print a single line containing the number of independent groups of Gorelians that remain after the regrouping process finishes.