1 #include<iostream>
2 #include<cstdio>
3 using namespace std;
4 const int N=60;
5 int f[N],a[N];
6 int main()
7 {
8 int n;
9 scanf("%d",&n);
10 for(int i=1;i<=n;i++){
11 scanf("%d",a+i);
12 }
13 int now,c;
14 f[1]=1;
15 int ans=-1;
16 bool flag=false;
17 for(int i=2;i<=n;i++)
18 {
19 now=-1;
20 c=1;
21 flag=false;
22 for(int j=1;j<=i-1;j++)
23 {
24 if(a[i]>a[j]&&f[j]>now)
25 {
26 now=f[j];
27 c=j;
28 flag=true;
29 }
30 }
31 if(flag)
32 f[i]=f[c]+1;
33 else f[i]=1;
34 if(f[i]>ans)
35 ans=f[i];
36 }
37 printf("%d\n",ans);
38 return 0;
39 }