#include <bits/stdc++.h>
using namespace std;
void my_dbg() { cout << endl; }
template <typename Arg, typename... Args>
void my_dbg(Arg A, Args... B) {
  cout << ' ' << A;
  my_dbg(B...);
}
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
const ll inf = (ll)1e15;
const int ninf = INT_MIN;
const int mod = 1e9 + 7;
const int maxN = 1e6 + 2;
vector<pii> a(maxN);
vl dp(maxN);
vi nxt(maxN);
int n;
ll rec(int idx) {
  if (idx == n) return 0;
  if (idx + 2 >= n) return inf;
  ll& here = dp[idx];
  if (here != -1) return here;
  here = (a[idx + 2].first - a[idx].first) + rec(idx + 3);
  nxt[idx] = idx + 3;
  if (idx + 3 < n) {
    ll one_more = (a[idx + 3].first - a[idx].first) + rec(idx + 4);
    if (one_more < here) {
      here = one_more;
      nxt[idx] = idx + 4;
    }
  }
  if (idx + 4 < n) {
    ll two_more = (a[idx + 4].first - a[idx].first) + rec(idx + 5);
    if (two_more < here) {
      here = two_more;
      nxt[idx] = idx + 5;
    }
  }
  return here;
}
void solve() {
  scanf("%d", &n);
  for (int i = 0; i < (int)maxN; i++) {
    dp[i] = nxt[i] = -1;
  }
  for (int i = 0; i < (int)n; i++) {
    scanf("%d", &a[i].first);
    a[i].second = i;
  }
  sort(a.begin(), a.begin() + n);
  ll ans = rec(0);
  vi util(n, 0);
  int idx = 0, c = 1;
  while (idx < n) {
    for (int i = idx; i < (int)nxt[idx]; i++) util[a[i].second] = c;
    idx = nxt[idx];
    c++;
  }
  printf("%lld ", ans);
  printf("%d\n", (int)(c - 1));
  for (auto it : util) printf("%d ", (int)(it));
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
