#c22505. 最长回文子串2

最长回文子串2

Longest Palindromic Subarray

Problem Description

Given an array a1,a2,…,ana_1, a_2, \dots, a_n of length nn, find the length of the longest palindromic contiguous subarray.

A subarray al,al+1,…,ara_l, a_{l+1}, \dots, a_r is palindromic if reading it forward is the same as reading it backward, i.e. al=ara_l = a_r, al+1=ar−1a_{l+1} = a_{r-1}, …\dots.

Input Format

The first line contains an integer nn, the number of elements.

The next line contains nn integers a1,a2,…,ana_1, a_2, \dots, a_n.

Output Format

One integer, the answer.

Sample Input

6
1 2 3 3 2 4

Sample Output

4

Constraints

For 100%100\% of the data: 1≤n≤1000001 \leq n \leq 100000, 1≤ai≤10001 \leq a_i \leq 1000.