#include<stdio.h> #define true 1 #define false 0 static int max = 0, j = 0, B[30]; int check() { int i; for (i = 0; i < j - 1; i++) { if (B[i] < B[i + 1])return false; } return true; } void backtracking(int* A, int n, int startIndex) { int i; if (startIndex >= n || check() == false)return; if (j > max)max = j; for (i = startIndex; i < n; i++) { B[j++] = A[i]; if (check() == true && j > max)max = j; backtracking(A, n, i + 1); j--; } } int main() { int i, n; for (i = 0; i < 30; i++)B[i] = 0; scanf("%d", &n); int A[n]; for (i = 0; i < n; i++)scanf("%d", &A[i]); backtracking(A, n, 0); printf("%d", max); return 0; }