CF599C Day at the Beach

题目描述

一天Squidward,Spongebob,Patrick决定一起去沙滩玩。不幸的是,天气实在不好,他们没法冲浪了。然鹅,他们决定建一个沙堡。 那天快结束的时候,他们建了n个城堡。城堡被编号为1到n,第i个城堡的高度是hi。就在大家都要走的时候,Squidward注意到,沙堡没有按它们的高度排序,这看起来很不和谐,。现在,他们将重新排列城堡,使对于所有的i,(0

输入格式

第一行包括一个数n(1

输出格式

输出最大可能的序列被划分的段数。

说明/提示

In the first sample the partitioning looks like that: \[1\]\[2\]\[3\]. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF599C/b9501a337331292f74a6e93736c318ca0eb6dcc6.png)In the second sample the partitioning is: \[2, 1\]\[3, 2\] ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF599C/631d2d13363437c6480fbc010a49d25892b48bb7.png)