#!/usr/bin/ python3.8 import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np N = int(readline()) A = np.array(read().split(), np.int32) # 長さ 1 dpl = np.ones(N, np.int32) dpr = np.ones(N, np.int32) answer = 0 for n in range(2, N + 1): x = dpl[:-1] y = (1 + dpr[1:]) * (A[0: N - n + 1] < A[n - 1:N]) newdpl = np.maximum(x, y) x = dpr[1:] y = (1 + dpl[:-1]) * (A[n - 1:N] < A[0: N - n + 1]) newdpr = np.maximum(x, y) dpl, dpr = newdpl, newdpr answer = max(answer, dpl.max(), dpr.max()) print(answer)