N = int(input()) L = list(map(int, input().split())) result = 0 for i in range(N): a = len([x for x in range(i+1,N) if L[x] < L[i]]) if a > result: result = a print(result)