#CCBCHBA0000057. Dãy liên tiếp trước ngưỡng (Longest Equal Run)

Dãy liên tiếp trước ngưỡng (Longest Equal Run)

Longest Equal Run

Source: Phước Hưng OJ

Version: Phuoc Hung OJ Extended

Problem Statement

Given a sequence of n integers, find the maximum length of a contiguous run in which all adjacent values are equal. There is no threshold variable in this task; the catalogue title is retained for reference.

Input

The first line contains n (1 <= n <= 100000). The next line contains exactly n integers a_i, each between -10^9 and 10^9.

Output

Print the length of the longest contiguous run of equal values.

Subtasks

  • Subtask 1 (20%): n≤5,∣ai∣≤10n\le5, |a_i|\le10.
  • Subtask 2 (30%): n≤500,∣ai∣≤104n\le500, |a_i|\le10^4.
  • Subtask 3 (50%): n≤100000,∣ai∣≤109n\le100000, |a_i|\le10^9.

Examples

Example 1

Input:

8
4 4 2 2 2 7 7 2

Output:

3

Explanation:

The contiguous run 2,2,2 has length three; the last 2 is separate.

Example 2

Input:

1
-9

Output:

1

Explanation:

A single element forms a run of length one.