#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<pair<int, int>> skills(n);
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    skills[i] = {x, i + 1};
  }
  sort(skills.begin(), skills.end());
  int mayor = skills.back().first;
  vector<pair<int, int>> p, q;
  p.push_back(skills[0]);
  q.push_back(skills[1]);
  int suma_p = p[0].first;
  int suma_q = q[0].first;
  for (int i = 2; i < n; i++) {
    int x = p.size();
    int y = q.size();
    if (x == y) {
      p.push_back(skills[i]);
      suma_p += skills[i].first;
    } else if (x == y + 1) {
      q.push_back(skills[i]);
      suma_q += skills[i].first;
    } else if (x == y - 1) {
      p.push_back(skills[i]);
      suma_p += skills[i].first;
    } else {
    }
    if (suma_p - suma_q > mayor) {
      pair<int, int> jugador = p.back();
      int elem = jugador.first;
      p.pop_back();
      q.push_back(jugador);
      suma_p -= elem;
      suma_q += elem;
    } else if (suma_p - suma_q < -mayor) {
      pair<int, int> jugador = p.back();
      int elem = jugador.first;
      q.pop_back();
      p.push_back(jugador);
      suma_q -= elem;
      suma_p += elem;
    }
  }
  cout << p.size() << "\n";
  cout << p[0].second;
  for (int i = 1; i < p.size(); i++) {
    cout << " " << p[i].second;
  }
  cout << "\n" << q.size() << "\n";
  cout << q[0].second;
  for (int i = 1; i < q.size(); i++) {
    cout << " " << q[i].second;
  }
  cout << "\n";
  return 0;
}
