#T343. 拦截导弹问题

拦截导弹问题

Description

A certain country has developed a missile interception system to defend against enemy missile attacks. However, this system has a flaw: while its first projectile can reach any altitude, each subsequent projectile cannot exceed the altitude of the previous one.
One day, the radar detects incoming enemy missiles. Since the system is still in the trial phase, a single system might not be able to intercept all the missiles.
Given the sequence of altitudes of the incoming missiles (the radar provides altitudes as positive integers not exceeding 30,000), calculate the minimum number of such missile interception systems required to intercept all the missiles.

Input Format

The altitudes of n sequentially incoming missiles (1 ≤ n ≤ 1000).

Output Format

The minimum number of systems k required to intercept all the missiles.

389 207 155 300 299 170 158 65

2

Hint

Input: Missile heights: 4 3 2
Output: Missile interception systems k=1