#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <bitset>
#include <string>
#include <cstdio>
#include <cmath>
#include <climits>
#include <fstream>
using namespace std;

const long long INF = LLONG_MAX;
const long long MOD = 1000000007;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

ostream& operator<<(ostream& os, vector<vector<char>> v)
{
    for (int y = 0; y < v.size(); y++)
    {
        for (int x = 0; x < v[y].size(); x++)
        {
            os << v[y][x];
        }
        os << endl;
    }

    return os;
}

class UnionFind
{
private:
    vector<int> parent;
public:
    UnionFind(int N)
    {
        parent.resize(N);
        for (int i = 0; i < N; ++i)
        {
            parent[i] = i;
        }
    }

    int root(int x)
    {
        if (parent[x] == x) return x;
        return parent[x] = root(parent[x]);
    }

    void unite(int x, int y)
    {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        parent[rx] = ry;
    }

    bool same(int x, int y)
    {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

long long comb2(long long n)
{
    return n * (n-1) / 2;
}

int main(void)
{
    int n;
    cin >> n;
    vector<pll> a(n);
    vector<long long> sum(n+1, 0);
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i].first;
        a[i].first %= 200;
        a[i].second = i + 1;
    }
    sort(a.begin(), a.end());

    for (int i = 0; i < n; ++i)
    {
        sum[i+1] = sum[i] + a[i].first;
    }

    vector<vector<pii>> v(200);
    for (int left = 0; left < n; ++left)
    {
        for (int right = left + 1; right <= n; ++right)
        {
            long long s = sum[right] - sum[left];
            long long mod = s % 200;
            v[mod].emplace_back(left, right);
        }
    }

    for (int mod = 0; mod < 200; ++mod)
    {
        if (v[mod].size() > 1)
        {
            cout << "Yes" << endl;
            for (int i = 0; i < 2; ++i)
            {
                cout << v[mod][i].second - v[mod][i].first;

                vector<int> index;
                for (int j = v[mod][i].first; j < v[mod][i].second; ++j)
                {
                    index.push_back(a[j].second);
                }
                sort(index.begin(), index.end());
                for (int i : index)
                {
                    cout << ' ' << i;
                }
                cout << endl;
            }
            return 0;
        }
    }

    cout << "No" << endl;
}
#include <bits/stdc++.h>
#include <cmath>
#include <unordered_set>
using namespace std;
using ll = long long;
using vi = vector<int>;
const int MOD = 1000000007;



int main() {
  int n;
  cin >> n;
  vector<ll> A(n);
  for(int i = 0; i < n; i++){
    ll a;
    cin >> a;
    A.at(i) = a;
  }
  
  sort(A.begin(), A.end());
  reverse(A.begin(), A.end());
 
  
  ll ans = 1;
  
  for(int i = 0; i < n-1; i++){
    ans *= A.at(i) - A.at(i+1) + 1;
    ans %= MOD;
  }
  
  ans *= A.at(n-1) + 1;
  ans %= MOD;
  
  cout << ans << endl;
}