Codeforces Round 208 (Div. 2)
A
Dima and Continuous Line
Codeforces
1400
原题
←B →
翻译中…

Dima and Seryozha live in an ordinary dormitory room for two. One day Dima had a date with his girl and he asked Seryozha to leave the room. As a compensation, Seryozha made Dima do his homework.

翻译中…

The teacher gave Seryozha the coordinates of $*n*$ distinct points on the abscissa axis and asked to consecutively connect them by semi-circus in a certain order: first connect the first point with the second one, then connect the second point with the third one, then the third one with the fourth one and so on to the $*n*$-th point. Two points with coordinates $(*x*_{1}, 0)$ and $(*x*_{2}, 0)$ should be connected by a semi-circle that passes above the abscissa axis with the diameter that coincides with the segment between points. Seryozha needs to find out if the line on the picture intersects itself. For clarifications, see the picture Seryozha showed to Dima (the left picture has self-intersections, the right picture doesn't have any).

翻译中…

image

翻译中…

Seryozha is not a small boy, so the coordinates of the points can be rather large. Help Dima cope with the problem.

翻译中…

Input

翻译中…

The first line contains a single integer $*n*$ $(1 ≤ *n* ≤ 10^{3})$. The second line contains $*n*$ distinct integers $*x*_{1}, *x*_{2}, ..., *x*_{*n*}$ $( - 10^{6} ≤ *x*_{*i*} ≤ 10^{6})$ — the $*i*$-th point has coordinates $(*x*_{*i*}, 0)$. The points are not necessarily sorted by their $*x*$ coordinate.

翻译中…

Output

翻译中…

In the single line print "yes" (without the quotes), if the line has self-intersections. Otherwise, print "no" (without the quotes).

翻译中…

Note

翻译中…

The first test from the statement is on the picture to the left, the second test is on the picture to the right.

翻译中…

样例

Input #1
4
0 10 5 15
Output #1
yes
InputCopy OutputCopy
Input #2
4
0 15 5 10
Output #2
no
InputCopy OutputCopy
题目信息
题号
358A
时间限制
2 s
内存限制
256 MB
标签
暴力
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。