#include <bits/stdc++.h>
using namespace std;
vector<int> v;
int main()
{
int a;
while (cin >> a)
{
bool f = false; // 假设不能打
int k = 0, t = 30005;
for (int i = 0; i < v.size(); i++)
{
if (v[i] >= a && v[i] < t)
{
k = i;
t = v[k];
f = true;
}
}
if (f)
v[k] = a;
else
v.push_back(a);
}
cout << v.size();
return 0;
}