#include <iostream>//cout<<right で右揃え
#include <iomanip>//cout<<setw(数字) で空白による桁揃え
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <cstdlib>//abs()で整数絶対値
#include <cmath>//abs()かfabs()で少数絶対値
#include <functional>//sort第三引数greater<>()で降順
#include <map>

#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; i++)
#define ALL(x) (x).begin(),(x).end()
using namespace std;
using ll = long long int;

int main(){
    int n;cin>>n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    vector<int> c(n);
    rep(i,n) c[i] = i + 1;
    sort(ALL(a));
    sort(ALL(c));
    if(a==c) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin >> n;

	vector<int> vec(n);
	for(int i = 0; i < n; ++i)
		cin >> vec[i];

	int ans = -1;
	for(int left = 0; left < n; ++left) {
		int min_app = vec[left];
		for(int right = left; right < n; ++right) {
			min_app = min(min_app, vec[right]);
			ans = max((right - left + 1) * min_app, ans);
		}
	}

	cout << ans << "\n";
	
}
			
