#CCBCHBAHAI0000068. Mảng đối xứng số nguyên (Integer Palindrome Array)

Mảng đối xứng số nguyên (Integer Palindrome Array)

Integer Palindrome Array (Mảng đối xứng số nguyên)

Source: Phước Hưng OJ

Version: Phuoc Hung OJ Extended

Problem

Given a0,a1,…,an−1a_0,a_1,\ldots,a_{n-1}, the array is palindromic if

ai=an−1−ifor every 0≤i<n.a_i=a_{n-1-i}\qquad\text{for every }0\le i<n.

It is sufficient to check 0≤i<⌊n/2⌋0\le i<\lfloor n/2\rfloor. Determine whether the array is palindromic.

Input

The first line contains nn. The second line contains nn integers aia_i.

Output

Print YES if the array is palindromic; otherwise print NO.

Subtask

Subtask 1 (20 points): 1≤n≤101\le n\le10, ∣ai∣≤103|a_i|\le10^3.

Subtask 2 (30 points): 1≤n≤50001\le n\le5000, ∣ai∣≤106|a_i|\le10^6.

Subtask 3 (50 points): 1≤n≤2⋅1051\le n\le2\cdot10^5, ∣ai∣≤109|a_i|\le10^9.

Example

Input

7
1 4 -2 9 -2 4 1

Output

YES

Explanation

The sample follows the mathematical definition above.