Dima and Continuous Line

题意翻译

在 $x$ 轴上存在 $n$ 个点 $(x_1,0),(x_2,0),(x_3,0),\dots ,(x_n,0)$,以相邻两点 $(x_i,0)$ 与 $(x_{i+1},0)$ 的连线作为直径向上作半圆,问是否有除 $x$ 轴上的交点。 【输入格式】 输入包含 $2$ 行: 第 $1$ 行一个整数 $n$,表示点的个数。 第 $2$ 行 $n$ 个整数,表示 $n$ 个点的坐标。 【输出格式】 若有,输出 `yes`,否则输出 `no`。 【数据范围】 $1 \le n \le 10^3, -10^6 \le x_i \le 10^6$。

题目描述

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). ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF358A/055f7a9956e4776dad6e638193fc0fef424d2028.png)Seryozha is not a small boy, so the coordinates of the points can be rather large. Help Dima cope with the problem.

输入输出格式

输入格式


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.

输出格式


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

输入输出样例

输入样例 #1

4
0 10 5 15

输出样例 #1

yes

输入样例 #2

4
0 15 5 10

输出样例 #2

no

说明

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