Cossack Vus and the Circle#10282

Cossack Vus and the Circle

1 saniye
256 megabayt
Kolay

Cossack Vus recently discovered a magical circle! This circle consists of vertices, where each vertex is connected to vertex i + 1 for 1 \le i < n, and vertex is connected back to vertex . Each vertex has an associated value a_i.

Cossack Vus is experimenting with the circle by selecting a number . If two adjacent vertices, and , have the same value a_i = a_j = x, he cuts the circle along the arc between these two vertices. The goal is to determine if there exists a number such that Cossack Vus can make at least two cuts.

Giriş

The first line contains a single integer (2 \le n \le 50) — the number of vertices in the circle.

The second line contains integers a_1, a_2, \dots, a_n (1 \le a_i \le 50) — representing the values at each vertex.

Çıktı

Print «Yes» if it is possible to choose a number that allows Cossack Vus to make at least two cuts. Otherwise, print «No».

Örnekler

Örnek 1

Loading
Loading

Örnek 2

Loading
Loading

Örnek 3

Loading
Loading