VM7WC '15 #2 Bronze - Recruits!

View as PDF

Submit solution

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

Problem type

Fire Lord Ozai, who is also known for being a Joker (tell me if you get this reference!), finds the number 41 extremely funny. He has lined up N 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 41. 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, N (1 \le N \le 20).

The next N 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


Sample Output


Explanation for Sample Output

Only the first soldier is ugly.


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

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

    • 1
      println_hi_  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

    • 1
      Anix55  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?