Counting problem (2)

Given a sequence of nn integer numbers x1xnx_1 \dots x_n, count how many ii’s, with 1in1 \le i \le n, follow the property

|{j:1jnxj<xi}|=i.\vert \{ j : 1 \le j \le n \wedge x_j < x_i \} \vert = i \enspace .

Input

The input consists of several cases. Each case begins with nn, followed by the nn integer numbers x1xnx_1 \dots x_n. Assume 0n1050 \le n \le 10^5.

Output

For each case, print the number of indices ii that fulfill the condition above.

Problem information

Author: Salvador Roura

Generation: 2026-01-25T10:19:03.995Z

© Jutge.org, 2006–2026.
https://jutge.org