https://www.acmicpc.net/problem/11722
n = int(input())
d = list(map(int, input().split()))
d.insert(0,0)
sequence = [1]*(n+1)
# sequence[i]는 i를 포함한 감소하는 수열중 가장 긴 수열
for i in range(n+1):
for j in range(i):
if d[j] > d[i] and sequence[i] < sequence[j]+1:
sequence[i] = sequence[j]+1
print(max(sequence))
n = int(input())
d = list(map(int, input().split()))
sequence = [1]*(n+1)
sequence[0]=0
# 0일 때도 신경써야 한다
for i in range(n+1):
for j in range(i):
if d[j] > d[i] and sequence[i] < sequence[j]+1:
sequence[i] = sequence[j]+1
print(max(sequence))
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
for (int i=0; i<n; i++) {
cin >> a[i];
}
vector<int> d(n);
for (int i=0; i<n; i++) {
d[i] = 1;
for (int j=0; j<i; j++) {
if (a[j] > a[i] && d[j]+1 > d[i]) {
d[i] = d[j]+1;
}
}
}
cout << *max_element(d.begin(),d.end()) << '\n';
return 0;
}