SYMN - Symmetric or not

no tags 

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

hide comments
Hits: 2015-06-12 20:46:26

just alittle change in xor program

Dushyant Singh: 2015-06-12 20:14:32

Got it! Xor program will fail for 4 2 3 2 3 4. It will give output as Yes but output will be No.

Dushyant Singh: 2015-06-12 19:40:24

XOR doesn't work here. Why? :-(

Dushyant Singh: 2015-04-04 21:37:33

WA. Don't know why.

Yash Singh: 2014-07-12 21:18:13

Got it now, {1,50,45,50,1} is a yes. :D

Yash Singh: 2014-07-12 20:51:53

I have one confusion, is {1,50,45,50,1} a yes or is {1,50,45,05,1} is a yes?

ananyadiwas: 2012-05-18 08:50:03

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

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