cho.sh
Notes
Loading...

Visible Squares

Time limit

2s

Memory limit

128 MB

Problem

There are N axis-aligned squares on a plane. Every vertex of every square has integer coordinates, and no two squares touch or overlap.

Count how many squares are visible from the origin O(0, 0).

A square is considered visible from the origin if there exist two distinct points A and B on its boundary such that the interior of triangle OAB, excluding the boundary of the triangle, is not crossed by any other square.

Input

The first line contains the number of squares N (1 <= N <= 1,000).

Each of the next N lines contains three integers X, Y, and L (1 <= X, Y, L <= 10,000), describing one square. Its lower-left vertex is (X, Y), and its side length is L.

Output

Print the number of squares visible from the origin.