## VM7WC '15 #2 Bronze - Recruits!

View as PDF

Points: 3
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

Fire Lord Ozai, who is also known for being a Joker (tell me if you get this reference!), finds the number extremely funny. He has lined up of his citizens with the intention of recruiting some of them for his army. When looking at a certain soldier, Ozai will consider him ugly if he and his adjacent soldiers in line are all less than or equal to a height of . Ozai needs to figure out just how ugly his potential recruits are. Help Ozai count the number of ugly soldiers in line.

#### Input Specification

The first line will contain the number of soldiers, . The next lines will contain the heights of all the soldiers in the order they are standing in line.

#### Output Specification

Print the number of ugly soldiers in line.

#### Sample Input

3
30
25
50

#### Sample Output

1

#### Explanation for Sample Input

Only the first soldier is ugly.

• commented on May 3, 2015, 3:40 a.m. edited

Resolved. By adjacent, it meant check circularly as well!

• commented on Oct. 21, 2016, 11:00 a.m.

I feel like that wouldn't be right, to check circularly. If so then the solider at 30 would be adjacent to 50(>41), not making it ugly and 25 is already not ugly meaning their are no ugly soldiers

• commented on Nov. 25, 2015, 3:39 p.m.

do you mean that the first person's adjacent soldiers are #2 and last person in line?