#CCBCHBAHAI0000064. Kiểm tra mọi phần tử bằng nhau (Check Whether All Elements Are Equal)

Kiểm tra mọi phần tử bằng nhau (Check Whether All Elements Are Equal)

Check Whether All Elements Are Equal (Kiểm tra mọi phần tử bằng nhau)

Source: Phước Hưng OJ

Version: Phuoc Hung OJ Extended

Problem

Given an integer array

a0,a1,…,an−1,a_0,a_1,\ldots,a_{n-1},

the array is called all-equal if

ai=a0for every 0≤i<n.a_i=a_0\qquad\text{for every }0\le i<n.

Determine whether the given array is all-equal. For n=1n=1, the condition is always true.

Input

The first line contains nn. The second line contains a0,a1,…,an−1a_0,a_1,\ldots,a_{n-1}.

Output

Print YES if all elements are equal; 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

5
7 7 7 7 7

Output

YES

Explanation

The sample follows the mathematical definition above.