#include <bits/stdc++.h>
using namespace std;
pair<long long, int> ar[200003 + 2];
long long DP[200003 + 2][2];
long long n;
long long dp(int i, bool fl) {
  if (i == n + 1) {
    if (fl == 0) return 0;
    return 2e18;
  }
  if (i > n + 1) return 2e18;
  long long &ret = DP[i][fl];
  if (ret != -1) return ret;
  ret = 2e18;
  if (fl == 0)
    ret = min(ret, -ar[i].first + dp(i + 2, 1));
  else {
    ret = min(ret, dp(i + 1, 1));
    ret = min(ret, +ar[i].first + dp(i + 1, 0));
  }
  return ret;
}
int team[200003 + 2];
long long res;
int cnt = 0;
void print(int i, bool fl) {
  if (i == n + 1) return;
  if (fl == 0) {
    res += ar[i].first;
    team[ar[i].second] = ++cnt;
    team[ar[i + 1].second] = cnt;
    print(i + 2, 1);
  } else {
    long long kop = dp(i + 1, 1);
    if (kop == res) {
      team[ar[i].second] = cnt;
      print(i + 1, 1);
    } else {
      team[ar[i].second] = cnt;
      res -= ar[i].first;
      print(i + 1, 0);
    }
  }
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> ar[i].first;
    ar[i].second = i;
  }
  sort(ar + 1, ar + n + 1);
  memset(DP, -1, sizeof DP);
  res = dp(1, 0);
  long long ans = res;
  print(1, 0);
  cout << ans << " " << cnt << endl;
  for (int i = 1; i <= n; i++) {
    if (i > 1) cout << " ";
    cout << team[i];
  }
  cout << endl;
  return 0;
}
