| 24 | } |
| 25 | |
| 26 | int main(void){ |
| 27 | ios::sync_with_stdio(false); |
| 28 | cin.tie(0); |
| 29 | |
| 30 | cin>>N; |
| 31 | for(int i=0; i<N; i++) |
| 32 | cin>>arr[i]; |
| 33 | |
| 34 | int end = 0; |
| 35 | LDS[end] = arr[0]; |
| 36 | for(int i=1; i<N; i++){ |
| 37 | if(LDS[end] <= arr[i]){ |
| 38 | int idx = search(0, end, arr[i]); |
| 39 | LDS[idx] = arr[i]; |
| 40 | } |
| 41 | else |
| 42 | LDS[++end] = arr[i]; |
| 43 | } |
| 44 | |
| 45 | cout<<end+1<<"\n"; |
| 46 | |
| 47 | return 0; |
| 48 | } |