SYMN - Symmetric or not

Given a list of numbers check if it is symmetric by its middle element or not i.e. {1, 2, 2, 1} and {1, 2, 3, 2, 1} are symmetric while {1, 2, 3} and {1, 2, 2} are not symmetric.

Input

First line contains N, size of the list (1 <= N <= 50) 

Second line contains N numbers (0 <= each number <= 50) representing the list of numbers.

Output

Prints one line containing either "Yes" if it is symmetric or "No" if it is not symmetric.

Example

Input:
5
1 2 3 2 1

Output:
Yes

Added by:Omar ElAzazy
Date:2012-03-14
Time limit:2s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64

hide comments
2015-06-12 20:46:26 Hits
just alittle change in xor program
2015-06-12 20:14:32 Dushyant Singh
Got it! Xor program will fail for 4 2 3 2 3 4. It will give output as Yes but output will be No.
2015-06-12 19:40:24 Dushyant Singh
XOR doesn't work here. Why? :-(
2015-04-04 21:37:33 Dushyant Singh
WA. Don't know why.
2014-07-12 21:18:13 Yash Singh
Got it now, {1,50,45,50,1} is a yes. :D
2014-07-12 20:51:53 Yash Singh
I have one confusion, is {1,50,45,50,1} a yes or is {1,50,45,05,1} is a yes?
2012-05-18 08:50:03 ananyadiwas
there should be or shouldn't be any space b/w the numbers in the 2nd line of input...plz clear the doubt

how many ever times i submitted im getting WA still by both the ways as mentioned with space & with out space

Last edit: 2012-05-18 16:24:39
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.