#include <bits/stdc++.h>
#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(),(x).end()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
using namespace std;
typedef double DB;
typedef long double LD;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<PII> VPII;
//head
const int N=1e4+5;
int n,a[N];
int main() {
    //freopen("E:/OneDrive/IO/in.txt","r",stdin);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    int res=0;
    for(int i=1;i<=n;i++) {
        int t=1;
        for(int j=i-1;j>=1;j--) {
            if(a[j]>=a[i]) ++t;
            else break;
        }
        for(int j=i+1;j<=n;j++) {
            if(a[j]>=a[i]) ++t;
            else break;
        }
        res=max(res,t*a[i]);
    }
    cout<<res<<'\n';
    return 0;
}
#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define rep(i,a,b)    for(ll i=a;i<b;i++)
#define repn(i,a,b)   for(ll i=a;i>=b;i--)
#define ld long double
#define fi first
#define se second
#define pii pair<ll,ll>
#define vi vector<ll>
#define vii vector<pii>
#define pb push_back
#define mp  make_pair
#define all(v) (v).begin(), (v).end()
#define sz(a) (ll)(a.size())
#define len(a) (ll)(a.length())
#define mem0(a) memset(a, 0, sizeof(a))
#define mem1(a) memset(a, -1, sizeof(a))
#define trav(a, x) for (auto &a : x)
#define popcount(x) __builtin_popcountll(x)
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define mod 1000000007
ll INF = 1e6;

void solve() {
    ll n;
    cin >> n;
    vi a(n), b(200);
    rep(i, 0, n) {
        cin >> a[i];
        b[a[i] % 200]++;
    }
    ll c = 0;
    rep(i, 0, 200) {
        c += b[i] * (b[i] - 1) / 2;
    }
    cout << c;

}
int main() {
    SPEED;
#ifndef ONLINE_JUDGE
    freopen("input1.txt", "r", stdin);
    freopen("output1.txt", "w", stdout);
#endif
    clock_t z = clock();
    ll t = 1;
    //cin >> t;
    while (t--) solve();
    debug("Total Time:%.3Lf\n", (ld)(clock() - z) / CLOCKS_PER_SEC);
    return 0;
}