Strange Obsession

5

1 votes
Easy
Problem

Babli is a student of Computer Science department at IIT Delhi. She has a strange obsession with sequences. She always calculates the goodness of a sequence to decide whether it is a bad sequence or good sequence. The goodness of a sequence is the size of the largest subarray such that all elements are same.

As a Computer Science student, Babli decides to write a program to calculate the goodness of a sequence, and asks for your help in writing the code. So, you have to write a program that given an array a of n integers, finds the largest size of a subarray in which all the elements are same.

Input:

First line contains the integer n . Next line contains n space separated integers containing the elements of the array.

Output:

Output one integer that is the answer to this problem.

Constraints:

1n105

0ai109

Useful links: Sub array

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Here the largest size subarray is the subarray (4,5), a[4]=a[5]=3. The size of this is 2.

Editor Image

?