Just dropped an apple

2 secs 1024 MB
TrueRyoB's icon TrueRyoB

difficulty: ★★☆☆☆☆

Problem Description

To stave off boredom, Yoji started imagining that apples have just fallen high from the sky. A kk-th apple takes exactly k1k-1 distance to an arbitrary direction from one of existing.

Nearby, there are NN number of parrots with an XX coordinate for each. To hit all the parrots, what is the minimum number of apples that he needs to summon?

Constraints

  • 1N20001 \leq N \leq 2000
  • 108Xi108-10^8 \leq X_i \leq 10^8
  • ijXiXji \neq j \to X_i \neq X_j

Input style

N
X_1 X_2 ... X_N

Input example 1

4
4 6 3 7

Output example 1

4

This is feasible by following the steps below.

  1. Drop at 33
  2. Drop at 44 from 33
  3. Drop at 66 from 44
  4. Drop at 77 from 44.

Input example 2

2
1 16

Output example 2

6

At times, it's inevitable to sacrifice some apples to reach a far target.

Input example 3

1
100000000

Output example 3

1

Hit one, and that's it!

Submit


Go (1.21)