Codeforces Round 543 (Div. 2, based on Technocup 2019 Final Round)
B
Mike and Children
Codeforces
1200
原题
← AC →
翻译中…

Mike decided to teach programming to children in an elementary school. He knows that it is not an easy task to interest children in that age to code. That is why he decided to give each child two sweets.

翻译中…

Mike has n sweets with sizes a1,a2,…,an. All his sweets have different sizes. That is, there is no such pair (i,j) (1≤i,j≤n) such that i≠j and ai=aj.

翻译中…

Since Mike has taught for many years, he knows that if he gives two sweets with sizes ai and aj to one child and ak and ap to another, where (ai+aj)≠(ak+ap), then a child who has a smaller sum of sizes will be upset. That is, if there are two children who have different sums of sweets, then one of them will be upset. Apparently, Mike does not want somebody to be upset.

翻译中…

Mike wants to invite children giving each of them two sweets. Obviously, he can't give one sweet to two or more children. His goal is to invite as many children as he can.

翻译中…

Since Mike is busy preparing to his first lecture in the elementary school, he is asking you to find the maximum number of children he can invite giving each of them two sweets in such way that nobody will be upset.

翻译中…

Input

翻译中…

The first line contains one integer n (2≤n≤1000) — the number of sweets Mike has.

翻译中…

The second line contains n integers a1,a2,…,an (1≤ai≤105) — the sizes of the sweets. It is guaranteed that all integers are distinct.

翻译中…

Output

翻译中…

Print one integer — the maximum number of children Mike can invite giving each of them two sweets in such way that nobody will be upset.

翻译中…

Note

翻译中…

In the first example, Mike can give 9+2=11 to one child, 8+3=11 to another one, and 7+4=11 to the third child. Therefore, Mike can invite three children. Note that it is not the only solution.

翻译中…

In the second example, Mike can give 3+9=12 to one child and 1+11 to another one. Therefore, Mike can invite two children. Note that it is not the only solution.

翻译中…

样例

Input #1
8
1 8 3 11 4 9 2 7
Output #1
3
InputCopy OutputCopy
Input #2
7
3 1 7 11 9 2 12
Output #2
2
InputCopy OutputCopy
题目信息
题号
1121B
时间限制
2 s
内存限制
256 MB
标签
暴力
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。