Shooting Championship
The winner of the school-level informatics olympiad discovered an old document at home containing the results of a national archery championship in which his father competed. Unfortunately, the document was heavily damaged over time, making it impossible to read the participants' surnames. Only the scores achieved by each participant were legible, and these scores were listed in the order of their performances.
After speaking with his father, the student learned that his father's score ended with the digit 5. Additionally, one of the championship winners had shot before his father, and his father's friend, who shot immediately after him, had a lower score. The student is now curious to determine the highest possible rank his father could have achieved in that championship.
A participant is considered to have finished in k-th place if exactly (k - 1) participants scored strictly more points than they did. All participants who tied for first place are considered winners.
Your task is to write a program that, given the championship results, calculates the highest possible rank the student's father could have achieved.
Input
The first line of the input contains an integer n — the number of participants in the national archery championship (3 ≤ n ≤ 10^5).
The second line contains n positive integers, each not exceeding 1000, representing the scores of the participants in the order they performed.
Output
The output should be a single integer — the highest rank the student's father could have achieved. If no participant meets the conditions described, output 0.