Given a natural number
N - the number of numbers that are input. Determine if the input numbers form an alternating sequence.
Input
The first line contains a natural number
N (N<10
5). The following
N lines contain non-zero numbers, one per line. Each number does not exceed 10
9.
Imprint
Print
YES if the numbers form an alternating sequence, otherwise print
NO.
Examples
| # |
Input |
Output |
| 1 |
5
1
-2
3
-4
5 |
YES |
| 2 |
5
5
4
3
2
1 |
NO |
Запрещенные операторы:[