import copy def isOneTypeInList(list): for t in list: if list.count(t) <= 1: return False return True def roast(list, i): l = copy.deepcopy(list) j = l.pop(i) k = l.pop(i) l.insert(i,j+k) return l def loop(list): if len(list) <= 1: return len(list) elif isOneTypeInList(list): return len(list) elif len(list) == 2: return 1 else: minIndex = list.index(min(list)) if minIndex == 0: return loop(roast(list, minIndex)) elif minIndex == len(list) - 1: return loop(roast(list, minIndex - 1)) else: f = loop(roast(list, minIndex)) b = loop(roast(list, minIndex - 1)) return max(f,b) n = input() beans = list(map(int, input().split())) print(loop(beans))