#include using namespace std::literals::string_literals; using i64 = long long; using std::cout; using std::endl; using std::cin; template std::vector make_v(size_t a){return std::vector(a);} template auto make_v(size_t a,Ts... ts){ return std::vector(ts...))>(a,make_v(ts...)); } int main() { // input int n; scanf("%d", &n); assert(1 <= n and n <= (int)1e5); std::vector a(n); for(int i = 0; i < n; i++) { scanf("%d", &a[i]); assert(1 <= a[i] and a[i] <= (int)1e5); } // solve int ans = 0; for(int i = 0; i < (1 << n); i++) { int latte = 0, tmp = 0, buf = 0; for(int j = 0; j < n; j++) { if(i >> j & 1) { if(tmp == a[j]) buf++; else if(tmp < a[j]) { tmp = a[j]; buf = 1; } } else { latte += buf; tmp = buf = 0; } } latte += buf; ans = std::max(ans, latte); } printf("%d\n", ans); return 0; }