409150: GYM103447 B Magical Subsequence
Description
Given a sequence $$$A_1, A_2, \cdots, A_n$$$. As for a subsequence $$$A_{b_1}, A_{b_2}, \cdots, A_{b_m} \, (1\le b_1 < b_2 < \cdots < b_m \le n)$$$, we say it magical if and only if $$$m$$$ is even and $$$A_{b_1} + A_{b_2} = A_{b_3} + A_{b_4} = \cdots = A_{b_{m-1}} + A_{b_m}$$$. Determine the maximum length among all magical subsequences of the given sequence.
InputThe first line contains one integer $$$n\,(2\le n \le 10^5)$$$, denoting the length of given sequence.
The second line contains $$$n$$$ integers $$$A_1, A_2, \cdots, A_n \, (1\le A_i \le 100)$$$, denoting the given sequence.
OutputOutput one line containing only one integer, denoting the answer.
ExampleInput11 3 1 4 1 5 9 2 6 5 3 5Output
6Note
One possible magical subsequence of length 6 is $$$\{A_1 = 3, A_5 = 5, A_7 = 2, A_8 = 6, A_9 = 5, A_{10} = 3\}$$$. Here $$$3 + 5 = 2 + 6 = 5 + 3 = 8$$$.