#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[100000];
  scanf(" %d", &n);
  for (int i = 0; i < n; ++i) scanf(" %d", &a[i]);
  int dp[100000] = {0};
  dp[0] = 1;
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j < i; ++j) {
      if (a[j] < a[i])
        dp[i] = max(dp[i], dp[j] + 1);
      else
        dp[i] = max(dp[i], 1);
    }
    ans = max(ans, dp[i]);
  }
  printf("%d\n", ans);
}
