#C10255. Maximum Consecutive Climb Counter

    ID: 39440 Type: Default 1000ms 256MiB

Maximum Consecutive Climb Counter

Maximum Consecutive Climb Counter

You are given an integer n representing the number of mountains, followed by n space-separated integers that represent the heights of these mountains. A climb is defined as a sequence of consecutive mountains where each mountain is strictly taller than the previous one. However, after each climb, a rest day is required, which effectively halves the number of possible climbs.

Formally, let \(c\) be the total number of times the height increases when traversing the list. The maximum number of climbs is \(\lfloor c/2 \rfloor\).

Your task is to determine this maximum number of climbs.

inputFormat

The input is given via standard input (stdin) as follows:

  • The first line contains an integer n (1 ≤ n ≤ 105), the number of mountains.
  • The second line contains n space-separated integers representing the heights of the mountains.

outputFormat

Output a single integer representing the maximum number of climbs to standard output (stdout).

## sample
7
2 3 4 2 5 6 7
3