Election of the Leader
In the world of Draenor, orcs are a formidable race known for their strength and courage in battle, though not particularly for their intelligence. Each year, orcs from various clans gather in the Valley of Strength to select the leader of the Horde. Unlike humans, orcs do not engage in voting with ballots and polling stations, which are alien concepts to them. Instead, they determine their leader through a series of fair duels. In each duel, two candidates face off, with one emerging as the victor and the other being defeated. An orc who loses a duel is eliminated from the competition and cannot participate in further duels. The last orc standing after all the duels becomes the leader of the Horde.
The orc elders, who oversee these contests, enjoy predicting the outcomes. However, predicting the overall winner or even the victor of a specific duel is not always straightforward. The outcome depends on the strength of the opponents—typically, the stronger orc wins. However, if two orcs have equal strength, the result is uncertain and could go either way, depending on fate.
The elders have asked you to develop a program that determines how many contenders have a chance to become the leader.
Input
The first line of the input provides the number N of contenders vying for the leadership this year (1 ≤ N ≤ 1000000). The second line lists N integers, each ranging from 1 to 10000, representing the strength of each candidate.
Output
The output should be a single number indicating the count of contenders who have the potential to become the leader.