#include <bits/stdc++.h>
#define DEBUG if(0)
#define lli long long int
#define ldouble long double
using namespace std;

const int maxN = 1e4; int n;
int a[maxN];

int main()
{
  while (~scanf("%d", &n))
  {
    for (int i = 0; i < n; i++)
      scanf("%d", &a[i]);

    int ans = 0;
    for (int i = 0; i < n; i++)
    {
      int curr = a[i];
      for (int j = i; j < n; j++)
      {
        curr = min(curr, a[j]);
        ans = max(ans, curr * (j - i + 1));
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,n) for(int i=0;i<n;i++)

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

  ll n2 = n*2, ans = 0;
  ll sq = sqrt(n2);
  for (ll x = 1; x <= sq; x++) {
    if (n2 % x) continue; // 約数ではない

    ll y = n2/x;
    bool ok = (x+y-1) % 2 == 0 && (x-y+1) % 2 == 0;
    if (ok) ans += x==y ? 1 : 2;
  }

  cout << ans << endl;
  return 0;
}