#P1302. 可见矩形

可见矩形

Description

Given nn pairwise non-overlapping (their common area is zero) squares on the plane, whose vertex coordinates are all integers. Let the origin be O(0,0)O(0,0). For any square RR, if there exist two distinct points AA and BB on the boundary of RR such that the interior of OAB\triangle OAB has no common point with any other square, then we say that RR is visible from OO.

Given these nn pairwise non-overlapping squares, compute the number of squares visible from the origin OO.

Input Format

The first line contains the number of squares nn (1n10001 \le n \le 1000).

Each of the next nn lines contains three integers X,Y,LX,Y,L describing a square. Here XX and YY are the coordinates of the lower-left vertex, and LL is the side length, where 1X,Y,L100001 \le X, Y, L \le 10000.

Output Format

Output a single line containing one integer, the number of squares visible from the origin OO.

3
2 6 4
1 4 1
2 4 1

3

Hint

Translated by ChatGPT 5