Number of nails
On a square table, there are N
rectangular sheets of paper placed, with their sides aligned parallel to the table's edges. The integer coordinates of pairs of opposite vertices for each rectangle are provided in a coordinate system where the origin is at one corner of the table, and the axes extend along two perpendicular edges of the table.
Your task is to determine the minimum number of nails needed to secure all the sheets to the table. A sheet is considered secured if at least one nail penetrates its interior (nails that only touch the edges of the sheet do not count as securing it).
Input
The first line contains the integer N
(1 ≤ N ≤ 20
). Each of the following N
lines contains four non-negative integers, representing the coordinates of two opposite vertices of each rectangle. The numerical values do not exceed 100.
Output
Output a single number - the minimum number of nails required.