import java.io.PrintStream; import java.util.Arrays; import java.util.Scanner; /** * Solution to Mountainous Palindromic Subarray * * @author vanb */ public class mps_vanb { /** Input. */ private static Scanner sc; /** Output. */ private static PrintStream ps; /** * Do it! */ private void doit() { // Read the data int n = sc.nextInt(); int x[] = new int[n]; for( int i=0; i=n || ilo<0 || x[ihi]!=x[ilo] || x[ilo]>=x[ilo+1] ) break; ++offset; } // Must be at least 3 to be Mountainous int count = 2*offset - 1; if( count>2 && count>longest ) longest = count; } ps.println( longest ); } /** * Main. * * @param args unused * @throws Exception */ public static void main( String[] args ) throws Exception { sc = new Scanner( System.in ); ps = System.out; new mps_vanb().doit(); } }