E. Crystal Cascade
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Espeon has the biggest mouth in the world, always claiming to be the number one psychic-type Pokémon, which incurs the wrath of Mewtwo. Sick of Espeon's constant boasting, Mewtwo challenges Espeon to a psychic duel with a stack of Z-Crystals.

The rules of the game are as follows. Mewtwo and Espeon take turns drawing a Z-Crystal from the top of the stack and reading its strength value $$$s$$$ $$$(1 \le s \le 100)$$$. The player then makes one of the following two choices:

  • Discard the drawn Z-Crystal, with no side-effects.
  • Crush the Z-Crystal, eliminating the next $$$s$$$ Z-Crystals from the top of the stack.
If there are fewer than $$$s$$$ Z-Crystals in the stack after drawing, then the Z-Crystal cannot be crushed and must instead be discarded. A player wins when they remove the last Z-Crystal from the stack, leaving it empty.

To any other Pokemon, the strength values would be hidden until drawing the Z-Crystal, but since both Mewtwo and Espeon are Psychic types, they can use Future Sight to learn the strengths of all the Z-Crystals before the first card is drawn. Mewtwo, overly confident as always, allows Espeon to pick whether to go first or second. Unbeknownst to Mewtwo, Espeon is a highly skilled gamer, so Espeon knows that this choice can guarantee victory. Assuming both Mewtwo and Espeon play optimally, determine who wins if Espeon starts first.

Input

The first line will be an integer $$$N$$$ ($$$1 \leq N \leq 10^5$$$), the number of Z-Crystals in the deck.

The next line will contain $$$N$$$ space-separated integers $$$s_i$$$ ($$$1 \leq s_i \leq 100$$$), the strengths of the Z-Crystals in the order they appear in the stack; the leftmost integer represents the Z-Crystal on the top of the stack at the start of the game.

Output

If Espeon can win by going first, output "YES". Otherwise, output "NO". You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).

Examples
Input
2
1 1
Output
YES
Input
3
1 1 1
Output
NO
Input
5
5 3 1 1 1
Output
NO