#include <bits/stdc++.h>
using namespace std;
int n, k, m, cnt, ans;
vector<int> a[10001], f, s;
vector<pair<int, int>> r;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &k);
    a[k].push_back(i);
  }
  for (int i = 1; i <= 1e4; ++i) {
    if (a[i].size() & 1) {
      r.push_back(make_pair(i, a[i][a[i].size() - 1]));
      a[i].pop_back();
    }
    for (int j = 0; j < a[i].size(); ++j) {
      if (j & 1)
        f.push_back(a[i][j]);
      else
        s.push_back(a[i][j]);
    }
  }
  sort(r.begin(), r.end());
  for (int i = r.size() - 1; i >= 0; --i) {
    if (i & 1)
      f.push_back(r[i].second);
    else
      s.push_back(r[i].second);
  }
  printf("%d\n", f.size());
  for (int i = 0; i < f.size(); ++i) printf("%d ", f[i] + 1);
  printf("\n");
  printf("%d\n", s.size());
  for (int i = 0; i < s.size(); ++i) printf("%d ", s[i] + 1);
  return 0;
}
