#K2221. Palindromic Array Check

    ID: 24689 Type: Default 1000ms 256MiB

Palindromic Array Check

Palindromic Array Check

Given an array of integers, determine whether the array is a palindrome. An array is considered a palindrome if it reads the same forwards and backwards. Mathematically, for an array \(a_1, a_2, \ldots, a_n\), the palindrome condition is:

\[ a_i = a_{n-i+1} \quad \text{for } 1 \leq i \leq n \]

Your task is to implement a solution that reads the input from standard input (stdin) and prints the result to standard output (stdout). If the array is a palindrome, print YES, otherwise print NO.

Example:

Input:
5
1 2 3 2 1

Output: YES

</p>

inputFormat

The first line contains a single integer \(n\) representing the number of elements in the array. The second line contains \(n\) space-separated integers.

For example:

5
1 2 3 2 1

outputFormat

Print a single line containing YES if the input array is a palindrome, or NO if it is not.

## sample
5
1 2 3 2 1
YES