num= int(input()) ret = [] student = list(map(int, input().split())) def deep(l): dp = [1] * len(l) for i in range(len(l)): for j in range(i): if l[i] > l[j]: dp[i] = max(dp[i],dp[j]+1) return dp left = deep(student) right = deep(student[::-1])[::...