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 (x1, 0) and (x2, 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 ≤ 103). The second line contains n distinct integers x1, x2, ..., xn ( - 106 ≤ xi ≤ 106) — the i-th point has coordinates (xi, 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).

Examples

Input

4
0 10 5 15


Output

yes


Input

4
0 15 5 10


Output

no

Note

The first test from the statement is on the picture to the left, the second test is on the picture to the right.
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;

public class Codeforces {

    private static Print writer;

    private static Scan reader;

    static class Scan {
        private byte[] buf = new byte[1024]; // Buffer of Bytes
        private int index;
        private InputStream in;
        private int total;

        public Scan() throws IOException {
            in = System.in;
        }

        private int next() throws IOException { // Scan method used to scan buf
            if (total < 0)
                throw new InputMismatchException();
            if (index >= total) {
                index = 0;
                total = in.read(buf);
                if (total <= 0)
                    return -1;
            }
            return buf[index++];
        }

        int ni() throws IOException {
            int integer = 0;
            int n = next();
            while (isWhiteSpace(n)) // Removing startPointing whitespaces
                n = next();
            int neg = 1;
            if (n == '-') { // If Negative Sign encounters
                neg = -1;
                n = next();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    integer *= 10;
                    integer += n - '0';
                    n = next();
                } else
                    throw new InputMismatchException();
            }
            return neg * integer;
        }

        long nl() throws IOException {
            long integer = 0;
            int n = next();
            while (isWhiteSpace(n)) // Removing startPointing whitespaces
                n = next();
            int neg = 1;
            if (n == '-') { // If Negative Sign encounters
                neg = -1;
                n = next();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    integer *= 10;
                    integer += n - '0';
                    n = next();
                } else
                    throw new InputMismatchException();
            }
            return neg * integer;
        }

        String line() throws IOException {
            StringBuilder sb = new StringBuilder();
            int n = next();
            while (isWhiteSpace(n))
                n = next();
            while (!isNewLine(n)) {
                sb.append((char) n);
                n = next();
            }
            return sb.toString();
        }

        private boolean isNewLine(int n) {
            return n == '\n' || n == '\r' || n == -1;
        }

        private boolean isWhiteSpace(int n) {
            return n == ' ' || isNewLine(n) || n == '\t';
        }

        int[] nia(int n) throws Exception {
            if (n < 0)
                throw new Exception("Array size should be non negative");
            int[] array = new int[n];
            for (int i = 0; i < n; i++)
                array[i] = ni();
            return array;
        }

        int[][] n2dia(int r, int c) throws Exception {
            if (r < 0 || c < 0)
                throw new Exception("Array size should be non negative");
            int[][] array = new int[r][c];
            for (int i = 0; i < r; i++)
                array[i] = nia(c);
            return array;
        }

        long[] nla(int n) throws Exception {
            if (n < 0)
                throw new Exception("Array size should be non negative");
            long[] array = new long[n];
            for (int i = 0; i < n; i++)
                array[i] = nl();
            return array;
        }

        float[] nfa(int n) throws Exception {
            if (n < 0)
                throw new Exception("Array size should be non negative");
            float[] array = new float[n];
            for (int i = 0; i < n; i++)
                array[i] = nl();
            return array;
        }

        double[] nda(int n) throws Exception {
            if (n < 0)
                throw new Exception("Array size should be non negative");
            double[] array = new double[n];
            for (int i = 0; i < n; i++)
                array[i] = nl();
            return array;
        }
    }

    static class Print {
        private final BufferedWriter bw;

        Print() {
            bw = new BufferedWriter(new OutputStreamWriter(System.out));
        }

        <T> void print(T str) {
            try {
                bw.append(str.toString());
            } catch (IOException e) {
                System.out.println(e.toString());
            }
        }

        void println() {
            print("\n");
        }

        <T> void println(T str) {
            print(str + "\n");
        }

        void flush() throws IOException {
            bw.flush();
        }

        void close() {
            try {
                bw.close();
            } catch (IOException e) {
                System.out.println(e.toString());
            }
        }
    }

    public static void main(String[] args) throws Exception {
        long startPointTime = System.currentTimeMillis();
        reader = new Scan();
        writer = new Print();
        main2();
        long endTime = System.currentTimeMillis();
        float totalProgramTime = endTime - startPointTime;
        if (args.length > 0 && args[0].equals("time"))
            writer.print("Execution time is " + totalProgramTime + " (" + (totalProgramTime / 1000) + "s)");
        writer.close();
    }

    static class DisjointSet {
        int[] arr;
        int[] size;

        DisjointSet(int n) {
            arr = new int[n + 1];
            size = new int[n + 1];
            makeSet();
        }

        void makeSet() {
            for (int i = 1; i < arr.length; i++) {
                arr[i] = i;
                size[i] = 1;
            }
        }

        void union(int i, int j) {
            if (i == j)
                return;
            if (i > j) {
                i ^= j;
                j ^= i;
                i ^= j;
            }

            i = find(i);
            j = find(j);

            if (i == j)
                return;
            arr[j] = arr[i];
            size[i] += size[j];
            size[j] = size[i];
        }

        int find(int i) {
            if (arr[i] != i) {
                arr[i] = find(arr[i]);
                size[i] = size[arr[i]];
            }
            return arr[i];
        }

        int getSize(int i) {
            i = find(i);
            return size[i];
        }

        public String toString() {
            return Arrays.toString(arr);
        }
    }

    static long MOD = 1_000_000_007L;

    static class Line {
        int from;
        int to;

        Line(int from, int to) {
            if (from > to) {
                this.from = to;
                this.to = from;
            } else {
                this.from = from;
                this.to = to;
            }
        }

        public String toString() {
            return "(" + from + "," + to + ")";
        }
    }

    static void main2() throws Exception {
        int n = reader.ni();
        Line[] arr = new Line[n - 1];
        int from = reader.ni();
        for (int i = 0; i < n - 1; i++) {
            int toto = reader.ni();
            arr[i] = new Line(from, toto);
            from = toto;
        }
        //writer.println(Arrays.toString(arr));
        for (int i = 0; i < arr.length; i++) {
            for (int j = i + 1; j < arr.length; j++) {
                if (intersects(arr, i, j)) {
                    writer.println("yes");
                    return;
                }
            }
        }
        writer.println("no");
    }

    // from always <= to
    static boolean intersects(Line[] arr, int i, int j) {
        // case 1 check
        if (arr[i].to <= arr[j].from || arr[j].to <= arr[i].from) {
            return false;
        }
        // case 5
        else if ((arr[j].from <= arr[i].from && arr[j].to >= arr[i].to)
                || (arr[i].from <= arr[j].from && arr[i].to >= arr[j].to)) {
            return false;
        }

        // case 2
        else if (arr[i].from == arr[j].from || arr[i].to == arr[j].to) {
            return false;
        }

        return true;

    }

    static int min(int... arr) {
        int min = Integer.MAX_VALUE;
        for (int var : arr) {
            min = Math.min(min, var);
        }
        return min;
    }

    static long gcd(long a, long b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }
}