#include <bits/stdc++.h>
using namespace std;
const int N=100010;
int a[N],f[N];
int n;
int main(){
ios::sync_with_stdio(0),cin.tie(0);
cin>>n;
for(int i=1;i<=n;++i)cin>>a[i];
int cnt=0;
for(int i=1;i<=n;++i){
if(f[cnt]<a[i])f[++cnt]=a[i];
else f[lower_bound(f+1,f+1+cnt,a[i])-f]=a[i];
}
cout<<cnt;
return 0;
}
1360C - Similar Pairs | 900A - Find Extra One |
1093D - Beautiful Graph | 748A - Santa Claus and a Place in a Class |
1511B - GCD Length | 676B - Pyramid of Glasses |
597A - Divisibility | 1632A - ABC |
1619D - New Year's Problem | 242B - Big Segment |
938A - Word Correction | 159C - String Manipulation 10 |
258A - Little Elephant and Bits | 1536C - Diluc and Kaeya |
1428C - ABBB | 1557A - Ezzat and Two Subsequences |
255A - Greg's Workout | 1059A - Cashier |
1389C - Good String | 1561A - Simply Strange Sort |
1337B - Kana and Dragon Quest game | 137C - History |
1443C - The Delivery Dilemma | 6C - Alice Bob and Chocolate |
1077C - Good Array | 285B - Find Marble |
6A - Triangle | 1729A - Two Elevators |
1729B - Decode String | 1729C - Jumping on Tiles |