Coin Slider

Choose the largest subset of at most 16 coins and an order of moves so no moving coin ever collides with a stationary or already-moved coin.

Hard8GeometryBit manipulationDynamic programmingGreedyNo attempts yetTime limit2sMemory limit512 MB

Problem

You are playing a coin puzzle. The rules are as follows.

There are NN coins on a table. The ii-th coin is a circle of radius rir_i, and its center is initially at (sxi,syi)(sx_i, sy_i). Each coin also has a target position: you have to move the ii-th coin so that its center is at (txi,tyi)(tx_i, ty_i). You move coins one at a time, and you can move each coin at most once. When you move a coin, it travels from its initial position to its target position along a straight line. In addition, coins must never collide with each other, including in the middle of a move.

The score of the puzzle is the number of coins you move from their initial positions to their target positions. Write a program that determines the maximum score for the given puzzle.

Input

The input consists of a single test case in the following format.

N
r1 sx1 sy1 tx1 ty1
.
.
.
rN sxN syN txN tyN

The first line contains an integer NN (1N161 \le N \le 16), the number of coins in the puzzle. The ii-th of the following NN lines contains five integers rir_i, sxisx_i, syisy_i, txitx_i, and tyity_i (1ri1,0001 \le r_i \le 1{,}000, 1,000sxi,syi,txi,tyi1,000-1{,}000 \le sx_i, sy_i, tx_i, ty_i \le 1{,}000, (sxi,syi)(txi,tyi)(sx_i, sy_i) \ne (tx_i, ty_i)). rir_i is the radius of the ii-th coin, (sxi,syi)(sx_i, sy_i) is its initial position, and (txi,tyi)(tx_i, ty_i) is its target position.

At their initial positions, no two coins touch or overlap. You can also assume that the maximum score does not change even if the radius of every coin changes by 10510^{-5}.

Output

Print the maximum score of the given puzzle on a single line.

Hint

In the first example, the third coin cannot move because the other two coins are in its way.

Example 1. Initial positions

Example 1. After the moves