import java.util.*;
import java.io.*;

public class Main
{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int[] nums = new int[n];
		for(int i=0;i<n;i++){
		    nums[i]=sc.nextInt();
		}
		//mountain 
		
		int[] pref= new int[n];
		int[] suf = new int[n];
		
		pref[0]=1;
		for(int j=1;j<n;j++){
		    if(nums[j-1] < nums[j]){
		        pref[j]=pref[j-1]+1;
		    }
		    else{
		        pref[j]=1;
		    }
		}
		
		suf[n-1]=1;
		for(int j=n-2;j>=0;j--){
		    if(nums[j]>nums[j+1]){
		        suf[j]=suf[j+1]+1;
		    }
		    else{
		        suf[j]=1;
		    }
		}
		int count=0;
		for(int j=1;j<n-1;j++){
		    count+=((pref[j]-1)*(suf[j]-1));
		}
		System.out.print("Total number of mountains : " + count);
		int res=Integer.MIN_VALUE;
		for(int j=1;j<n-1;j++){
		    int len = pref[j]+suf[j]-1;
		    res=Math.max(res,len);
		}
		System.out.print("Longest length of the mountain: " + res);
	}
}