#include<bits/stdc++.h>
using namespace std;
#define For(i,a,b) for(int i=(a),(i##i)=(b);i<=(i##i);++i)
#define Rep(i,n) for(int i=0,(i##i)=(n);i<(i##i);++i)
#define Fodn(i,a,b) for(int i=(a),(i##i)=(b);i>=(i##i);--i)
#define pln puts("")
#define il inline
#define ff first
#define ss second
using LL=long long;using u32=unsigned int;using u64=unsigned LL;using LD=long double;
template<typename T>using pii=pair<T,T>;
template<typename T>il bool read(T&x){
x=0;char c=getchar();int f=1;while(!isdigit(c)&&(c!='-')&&(c!=EOF))c=getchar();
if(c==EOF)return 0;if(c=='-')f=-1,c=getchar();
while(isdigit(c)){x=(x<<1)+(x<<3)+(c&15);c=getchar();}x*=f;return 1;}
template<typename T,typename...Args>
il bool read(T&x,Args&...args){bool res=1;res&=read(x);res&=read(args...);return res;}
const int M=1000000007,INF=0x3f3f3f3f;const LL INFLL=0x3f3f3f3f3f3f3f3fLL;
const int N=10010;const double EPS=1e-6;

LL n,f[N][16];
inline void init(){
    read(n);
    For(i,1,n)read(f[i][0]);
    int t=log(n)/log(2)+1;
    For(i,1,t-1)For(j,1,(n-(1<<i)+1))f[j][i]=min(f[j][i-1],f[j+(1<<(i-1))][i-1]);
}
il LL find(int l,int r){
    int k=log(r-l+1)/log(2);
    return min(f[l][k],f[r-(1<<k)+1][k]);
}
LL ans=0;
inline void solve(){
    For(i,1,n)For(j,i,n)ans=max(ans,(j-i+1)*find(i,j));
    printf("%lld\n",ans);
}
signed main(){
    init();solve();
    return 0;
}
#include<bits/stdc++.h>
#define l long 
#define ll long long 
#define ld long double 
#define MOD 1000000007
#define MAX_N 1000006
#define f first 
#define s second 
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
const ll inf=1e18;
ll gcd(ll a,ll b){
    if(a==0){
        return b;
    }
    if(b==0){
        return a;
    }
    return gcd(b,a%b);
}
int main(){
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    ll n,lcm=1;
    cin>>n;
    for(ll i=2;i<=n;i++){
        lcm=lcm*(i/gcd(i,lcm));
    }
    lcm++;
    cout<<lcm<<"\n";
    return 0;
}