#d2808. 最长同余子数组
最长同余子数组
Longest Congruent Subarray
Problem Description
You are given an array of length whose elements are pairwise distinct.
Find the longest contiguous subarray whose elements are congruent modulo some . Formally, find the longest and an such that
$$A_L \equiv A_{L+1} \equiv A_{L+2} \equiv \cdots \equiv A_R \pmod M$$(where means ).
Output only the length of this longest contiguous congruent subarray.
Input Format
The first line contains an integer .
The next line contains integers .
Output Format
Output one number: the length of the longest contiguous congruent subarray.
Sample Input
4
8 2 10 5
Sample Output
3
Note that are all even, so they are congruent modulo .