A fun game

Two players alternately take one or two numbers from either end of a sequence; decide if the first player can force an even total.

Medium7Game theoryDynamic programmingGreedyNo attempts yetTime limit1sMemory limit512 MB

Problem

Two players play a game on a sequence of NN natural numbers. Every number in the sequence is smaller than 2312^{31}, and the count of odd numbers is odd.

The rules are as follows.

  • The first player picks one number, or two adjacent numbers, from the front or the back of the sequence.
  • The first player removes the picked numbers from the sequence.
  • The second player then picks one number, or two adjacent numbers, from the front or the back in the same way, and removes them.
  • The two players alternate and repeat this until nothing is left to pick.
  • The player whose picked numbers add up to an even total wins. Zero is even.

The count of odd numbers is odd, so exactly one player ends with an even total. There is no draw.

For example, if the sequence is 1 3 5 2 4 6, the first player has exactly four options on the opening move: (1), (1 3), (6), (4 6).

The second player never makes a mistake. Decide whether the first player can win when both play as well as they can.

Input

The first line contains the length of the sequence NN (1N30001 \le N \le 3000). The second line contains the NN natural numbers of the sequence in order, separated by spaces. Each number is smaller than 2312^{31}, and the count of odd numbers is always odd.

Output

Print Yes on the first line if the first player can win, and No otherwise.