#K646. Counting Improving Periods

    ID: 32011 Type: Default 1000ms 256MiB

Counting Improving Periods

Counting Improving Periods

Given a sequence of daily performance scores as integers, an improving period is defined as a contiguous subarray where every subsequent score is strictly greater than its previous score.

Your task is to compute the total number of such improving periods. In mathematical terms, a subarray \(S = [s_1, s_2, \ldots, s_L]\) is considered improving if and only if \(s_1 < s_2 < \cdots < s_L\) for \(L \ge 2\). Note that single elements are not counted as an improving period.

inputFormat

The input is provided via standard input (stdin) in the following format:

  1. The first line contains a single integer \(n\) (\(1 \le n \le 10^5\)), representing the number of days.
  2. The second line contains \(n\) space-separated integers, where each integer denotes the performance score for that day.

outputFormat

Output a single integer to standard output (stdout) which is the total number of consecutive improving periods in the given sequence.

## sample
8
3 4 5 2 1 3 4 5
9