There are *n* psychos standing in a line. Each psycho is assigned a unique integer from 1 to *n*. At each step every psycho who has an id greater than the psycho to his right (if exists) kills his right neighbor in the line. Note that a psycho might kill and get killed at the same step. 

You're given the initial arrangement of the psychos in the line. Calculate how many steps are needed to the moment of time such, that nobody kills his neighbor after that moment. Look notes to understand the statement more precise.
The first line of input contains integer *n* denoting the number of psychos, (1 ≤ *n* ≤ 10<sup class="upper-index">5</sup>). In the second line there will be a list of *n* space separated distinct integers each in range 1 to *n*, inclusive — ids of the psychos in the line from left to right.
class CodeforcesTask319BSolution:
    def __init__(self):
        self.result = ''
        self.n = 0
        self.psychos = []

    def read_input(self):
        self.n = int(input())
        self.psychos = [int(x) for x in input().split(" ")]

    def process_task(self):
        changed = True
        steps = 0
        while changed:
            changed = False
            safe = 1
            newline = [self.psychos[0]]
            for x in range(len(self.psychos) - 1):
                if self.psychos[x + 1] > self.psychos[x]:
                    newline.append(self.psychos[x + 1])
                    safe += 1
            if safe == len(self.psychos):
                changed = False
            else:
                changed = True
                self.psychos = newline
            if changed:
                steps += 1
        self.result = str(steps)

    def get_result(self):
        return self.result


if __name__ == "__main__":
    Solution = CodeforcesTask319BSolution()
    Solution.read_input()
    Solution.process_task()
    print(Solution.get_result())
