TouchStone
请登录后使用
系统首页 　练习题库 　考试列表 　判题结果 　信息发布 　解题排行
P8259It's Gonna be AK
 限制 : 时间限制 : - MS   空间限制 : - KB 评测说明 : 2s 256MB
问题描述
Given a sequence $X$ of integers with length $n$, let $F(X)$ be the number of elements that occur in $X$ exactly twice.

You are given a sequence $A$. Find a contiguous subsequence $A'$ of $A$ that maximizes $F(A')$ and just print the maximum value of $F(A')$.

输入格式

The first line contains an integer $n$, which indicates the length of $A$

The second line contains $n$ integers

$0 < n \leqslant 2 \cdot 10^5$

$0 \leqslant A_i \leqslant 10^9$

输出格式

Output one line containing the maximum value of $F(A')$.

样例输入 1

10
2 3 3 3 4 3 4 3 3 1

2

样例输入 2

14
0 2 2 1 0 0 6 0 6 0 2 1 1 0

3