Олимпиадный тренинг

Задача 38270. Kindergarten


In the younger group of the kindergarten "Teletubbies" there are n children in total. Each of them, like any four-year-old, can easily start crying simply because his classmates also cry. So what if he doesn't know what's wrong? Comrades can't be wrong.

The teacher has been working in the kindergarten for many years, and is well versed in the children's mood. It is enough for her to look at the child to understand how tearful he is today: will he cry himself today because the compote is tasteless, will he burst into tears because Katya and Vanya are already crying, but he is not yet, or will he play with cubes with concentration, not paying attention to the tears and snot of comrades.

Knowing today's tearfulness of each of the children, determine whether today the whole group will sob at the same time, or will do without a mass hysteria.

Input
The first line contains an integer n (1n1000) — the number of children in the group. The next line contains n numbers separated by a space, and the i-th number qi (0qin−1  ) denotes the crying of the i-th child. The number qi indicates the number of children that must cry for this child to cry too. If qi = 0, then this child will definitely cry today just like that, regardless of his comrades. It is believed that a child cannot start crying if the right number of children do not cry around him. If a child starts crying, he will not calm down until the evening.

Imprint
Print "YES" if the whole group will cry at the same time, or "NO" otherwise.
Examples
# Input Output
1 4
1 0 1 2
YES
2 3
1 1 1
NO