include [HTML_REMOVED]
include [HTML_REMOVED]
include [HTML_REMOVED]
using namespace std;
int n;
const int N= 100010;
long long a[N];
int dp[N];
int main()
{
cin >>n;
for(int i=1;i<=n;i)
{
scanf(“%lld”,a+i);
}
dp[1]=a[1];
int len =1;
for(int i=2;i<=n;i)
{
if(a[i]>dp[len])
{
dp[++len] = a[i];
}
else
{
int id = lower_bound(dp+1,dp+len+1,a[i]) - dp;
dp[id] = a[i];
}
}
cout << len <<endl;
}