Under construction

Still being built. Things may change

Longest Ascending Contiguous Subsequence

Interview

Time limit2sMemory limit512 MB

Summary
Given a sequence of positive integers, find the length of the longest contiguous run whose elements are non-decreasing.
Level

Easy2 of 10

Topics
Array, Implementation, Brute force
Solved
No attempts yet

Problem

Given a sequence of positive integers A=(A1, A2, ..., AN) of length N. Find the length of the longest contiguous subsequence of A that is sorted in ascending order.

In other words, find the maximum value of r-l+1 over all pairs of integers l, r (1 ≦ l ≦ r ≦ N) satisfying Al ≦ Al+1 ≦ ... ≦ Ar.

Input

The input is given from standard input in the following format.

N
A1 A2 ... AN

Output

Print the length of the longest contiguous subsequence of the positive integer sequence A that is sorted in ascending order, on a single line.

Constraints

  • 1 ≦ N ≦ 100.
  • 1 ≦ Ai ≦ 2020 (1 ≦ i ≦ N).

Examples3

  1. Example 1

    Input
    10
    3 1 4 1 5 9 2 6 5 3
    
    Expected output
    3
    
  2. Example 2

    Input
    10
    9 8 7 6 5 5 4 3 2 1
    
    Expected output
    2
    
  3. Example 3

    Input
    9
    1 2 2 12 120 210 202 1010 2020
    
    Expected output
    6