public class Main {
/** 请完成下面这个函数,实现题目要求的功能 **/
/** 当然,你也可以不按照这个模板来作答,完全按照自己的想法来 ^-^ **/
static int pick(int[] peaches) {
Integer max =0;
int count = 0;
Map<Integer ,Integer> map= new LinkedHashMap<>();
for( int i =peaches.length-1 ;i >=0 ;i -- ){
count = 0;
int current= peaches[i];
for( Map.Entry<Integer ,Integer> entry : map.entrySet()){
int key = entry.getKey();
int value = entry.getValue();
if( current < key ){
count = count > value ? count : value ;
}
}
count += 1;
map.put(current,count);
max = max >count ?max : count;
}
return max;
}
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int trees = Integer.parseInt(in.nextLine().trim());
int[] peaches = new int[trees];
for (int i = 0; i < peaches.length; i++) {
peaches[i] = Integer.parseInt(in.nextLine().trim());
}
System.out.println(pick(peaches));
}
}