// Author:   old_school
// Created:  02.01.2021 17:30:15

#include<bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("avx,avx2,fma") 
#pragma GCC optimization ("unroll-loops")
using namespace std;
#define lld               long long int
#define ld                long double
#define pb                push_back
#define ppb               pop_back 
#define mp                make_pair
#define F                 first
#define S                 second
#define nl                '\n'
#define all(c)            (c).begin(),(c).end()
#define rall(c)           (c).rbegin(),(c).rend()
#define sz(c)             (c).size()
#define tr(x,a)           for(auto &a : x)
#define psnt(x,a)         (x).find(a)!=(x).end()
#define vpsnt(x,a)        find(all(x),a)!=(x).end()
#define MOD               1000000007
#define tod               1
#define pi                3.1415926536
#define itr(i,a,b)        for(lld i=a;i<=b;i++)
#define itrn(i,a,b)       for(lld i=a;i>=b;i--)
#define iot(n)            for(lld i=0;i<n;i++)
#define pls(n,arr)        lld arr[n]; iot(n)  cin>>arr[i];
#define bye               fflush(stdout)

typedef pair<lld,lld>     pii;
typedef pair<string,lld>  psi;

template <typename T>
bool mycomp(T x,T y){ 
   return (x==y);  //give your condition here
}
bool paircomp(const pair<lld,lld> &x,const pair<lld,lld> &y){ 
return x.second<y.second;
}

void solve(){
   lld n; cin>>n;
   lld a[n],b[n];
   iot(n) cin>>a[i]>>b[i];
   lld ans=0;
   iot(n){
   	itr(j,i+1,n-1){
   		
   		ld x2=1.00*abs(a[j]-a[i]);
   		ld y2=1.00*abs(b[j]-b[i]);
   		ld slope=1.00*y2/x2;
   		ld asf=1.00-slope;
   		ld bsf=1.00+slope;
   		if(asf>=0.00&&bsf>=0.00)  ans++;
   	//	if(aa>=0&&bb>=0) ans++;
   	}

   }cout<<ans;
}
int main(){
       ios_base::sync_with_stdio(false);
             cin.tie(0);
            cout.tie(0);
      lld t=1;// cin>>t;  
      while(t--){
            solve();
            cout<<endl;
      }
}


#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
const int INF = 1000000000;
const int MOD = 1000000007;
const ll llINF = 1000000000000000000;

// #include <atcoder/all>
// using namespace atcoder;
// #include <boost/multiprecision/cpp_int.hpp>
// using lll = boost::multiprecision::cpp_int;

void solve() {
  int n;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  ll ans = 0;
  for (int i = 0; i < n; ++i) {
    ll mini = llINF;
    for (int j = i; j < n; ++j) {
      mini = min(mini, a[j]);
      ans = max(ans, (ll(j) - ll(i) + 1) * mini);
    }
  }
  cout << ans << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  solve();
  return 0;
}