#include <bits/stdc++.h>
using namespace std;
const long long MAX = 1e6 + 8;
const long long sz = 1e5 + 5;
void f_io() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
}
int32_t main() {
  f_io();
  long long t = 1;
  while (t--) {
    long long n;
    cin >> n;
    std::vector<pair<long long, long long> > v;
    for (long long i = 1; i < n + 1; i++) {
      long long temp;
      cin >> temp;
      v.push_back({temp, i});
    }
    sort(v.begin(), v.end());
    std::vector<pair<long long, long long> > x;
    std::vector<pair<long long, long long> > y;
    long long sumx = 0, sumy = 0, p = v[n - 1].first;
    for (long long i = n - 1; i > -1; i--) {
      if (!(i % 2))
        x.push_back(v[i]), sumx += v[i].first;
      else
        y.push_back(v[i]), sumy += v[i].first;
    }
    while ((sumx - sumy) <= p &&
           ((x.size() - y.size()) <= 1 && (x.size() - y.size()) >= -1)) {
      long long val = x[0].first, ind = x[0].second;
      sumx -= val;
      sumy += val;
      x.erase(x.begin());
      y.push_back({val, ind});
    }
    cout << x.size() << "\n";
    for (auto k : x) cout << k.second << " ";
    cout << "\n";
    cout << y.size() << "\n";
    for (auto k : y) cout << k.second << " ";
    cout << "\n";
  }
}
