Public Judge

pjudge

时间限制: 1 s 内存限制: 256 MB 总分: 7 可 Hack ✓
统计

Given a sequence of length $n$, you need to find the longest subsequence such that the length of its longest increasing subsequence is strictly less than the length of the longest increasing subsequence of the original sequence.

Input

The first line contains a positive integer $n$.

The second line contains $n$ positive integers $a_1, a_2, \dots, a_n$.

Output

A single line containing a positive integer, representing the length of the longest valid subsequence.

Examples

Input 1

6
4 6 5 2 1 3

Output 1

4

Input 2-7

See the provided files.

Constraints

For all data, $1 \le n \le 5 \times 10^5$, $1 \le a_i \le 10^9$.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.