The sequence is called ordered if it is non-decreasing or non-increasing. For example, sequnces [3, 1, 1, 0] and [1, 2, 3, 100] are ordered, but the sequence [1, 3, 3, 1] is not. You are given a sequence of numbers. You are to find it's shortest subsequence which is not ordered.

A subsequence is a sequence that can be derived from the given sequence by deleting zero or more elements without changing the order of the remaining elements.
The first line of the input contains one integer *n* (1 ≤ *n* ≤ 10<sup class="upper-index">5</sup>). The second line contains *n* space-separated integers — the given sequence. All numbers in this sequence do not exceed 10<sup class="upper-index">6</sup> by absolute value.
def lcs(strings):
    count = len(strings)
    if count == 0:
        return None
    if count == 1:
        return strings[0]
    strings = sorted(strings, key=len)
    len0 = len(strings[0])
    if len0 == 0:
        return strings[0]

    for currentLength in range(len0, 0, -1):
        for startIndex in range(len0 - currentLength + 1):
            foundString = strings[0][startIndex:startIndex+currentLength]
            found = [False] * (count - 1)
            for stringNumber in range(1, count):
                string = strings[stringNumber]
                for startIndex2 in range(len(string) - currentLength + 1):
                    if string[startIndex2:startIndex2+currentLength] == foundString:
                        found[stringNumber-1] = True
                        break
                if not found[stringNumber-1]:
                    break
            if all(f for f in found):
                return foundString
    return None