#include<bits/stdc++.h>
using namespace std;

void p(){cout<<"Yes"<<endl;};
void q(){cout<<"No"<<endl;};

int main(){
  int N;cin>>N;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    int a;cin>>a;
    A.at(i)=a%200;
  }
  //sort(A.begin(),A.end());
  //set<int> s;
  map<int,vector<int>> X;
  /*for(int i=0;i<N;i++){
    if(s.count(A[i].first)){
      p();
      cout<<1<<' '<<A[i].second<<endl;
      cout<<X[A[i].first].size()<<' ';
      for(auto x:X[A[i].second]) cout<<x;
      cout<<endl;
      return 0;
    }
    else{
      s.insert(i);
      X[A[i].first].push_back(A[i].second);
    }
  }*/
  int n=min(N,16),cnt=0,y=0;
  int l=pow(2,n),m=0;
  //cout<<l<<endl;
  vector<int> Y;
  for(int i=1;i<l;i++){
    Y.clear();
    m=i;
    y=0;
    cnt=0;
    while(m>0){
      if(m&1){
        y+=A[cnt];
        Y.push_back(cnt+1);
      }
      m=m>>1;
      cnt++;
    }
    y%=200;
    sort(Y.begin(),Y.end());
    if(X.count(y)){
      p();
      cout<<X[y].size()<<' ';
      for(auto x:X[y]) cout<<x<<' ';
      cout<<endl;
      cout<<Y.size()<<' ';
      for(auto z:Y) cout<<z<<' ';
      cout<<endl;
      return 0;
    }
    else X[y]=Y;
  }
  q();
  return 0;
}
#include <iostream>
#include <vector>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <climits>
#include <cmath>
#include <algorithm>
#include <stack>

using namespace std;


typedef long long ll;
#define debuglist(x) for(int i = 0; i < x.size(); ++i) { cout << x[i] << " "; } cout << endl;

void solve(){
    int n;
    cin >> n;
    vector<int> ar(n+1, 0);
    for(int i = 0; i < n; ++i){
        cin >> ar[i];
    }

    stack<pair<int, int>> st;
    int maxOrange = 0;
    for(int i = 0; i < n+1; ++i){
        if(st.empty()) {
            st.push({ar[i], i});
        } else {
            int first_idx = -1;
            int first_min = INT_MAX;
            while(!st.empty() && ar[i] < st.top().first) {
                auto [val, idx] = st.top(); st.pop();
                int orange = val*(i-idx);
                maxOrange = max(orange, maxOrange);
                first_idx = idx;
                first_min = min(val, first_min);
            }
            if(first_idx != -1) {
                st.push({ar[i], first_idx});
            } else {
                st.push({ar[i], i});
            }
        }
    }
    cout << maxOrange << "\n";
}

int main() {
//    int cas;
//    cin >> cas;
//
//    while (cas--) {
//        solve();
//    }

    solve();

    return 0;
}

