#K1761. Count People With a Taller Right Neighbor

    ID: 24587 Type: Default 1000ms 256MiB

Count People With a Taller Right Neighbor

Count People With a Taller Right Neighbor

You are given a line of n people with respective heights. For each person, check whether the person immediately to their right has a strictly greater height. Your task is to count the number of people that satisfy this condition.

Formally, given an array \( H = [h_1, h_2, \dots, h_n] \), find the number of indices \( i \) (where \( 1 \le i < n \)) such that \( h_i < h_{i+1} \).

inputFormat

The input consists of two lines:

  • The first line contains an integer \( n \) representing the number of people.
  • The second line contains \( n \) space-separated integers representing the heights of the people.

outputFormat

Output a single integer, which is the count of people whose immediate right neighbor is taller.

## sample
5
1 2 3 4 5
4

</p>