#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int f = 1, x = 0;
  char ch;
  do {
    ch = getchar();
    if (ch == '-') f = -1LL;
  } while (ch < '0' || ch > '9');
  do {
    x = x * 10 + ch - '0';
    ch = getchar();
  } while (ch >= '0' && ch <= '9');
  return f * x;
}
inline long long readll() {
  long long f = 1, x = 0;
  char ch;
  do {
    ch = getchar();
    if (ch == '-') f = -1LL;
  } while (ch < '0' || ch > '9');
  do {
    x = x * 10 + ch - '0';
    ch = getchar();
  } while (ch >= '0' && ch <= '9');
  return f * x;
}
template <class T>
inline void chmax(T &a, T b) {
  if (a < b) a = b;
}
template <class T>
inline void chmin(T &a, T b) {
  if (a > b) a = b;
}
inline void swap(int &a, int &b) {
  int c = a;
  a = b;
  b = c;
}
using namespace std;
const int N = 2e5 + 10;
struct node {
  int a, p;
  node(int _a = 0, int _p = 0) : a(_a), p(_p) {}
  bool operator<(const node b) const { return a < b.a; }
} a[N];
int n;
long long sm[N], dp[N][4];
pair<int, int> pre[N][4];
int vis[N];
vector<int> team[N];
int ans[N];
int main() {
  n = read();
  for (int i = (1); i <= (n); ++i) a[i].a = read(), a[i].p = i;
  sort(a + 1, a + n + 1);
  memset(dp, 0x3f, sizeof(dp));
  dp[0][3] = 0;
  for (int i = (1); i <= (n); ++i) {
    if (dp[i][1] > dp[i - 1][3] - a[i].a) {
      dp[i][1] = dp[i - 1][3] - a[i].a;
      pre[i][1] = make_pair(i - 1, 3);
    }
    if (dp[i][2] > dp[i - 1][1] + a[i].a) {
      dp[i][2] = dp[i - 1][1] + a[i].a;
      pre[i][2] = make_pair(i - 1, 1);
    }
    if (dp[i][3] > dp[i - 1][2] - a[i - 1].a + a[i].a) {
      dp[i][3] = dp[i - 1][2] - a[i - 1].a + a[i].a;
      pre[i][3] = make_pair(i - 1, 2);
    }
    if (i != 1) {
      if (dp[i][3] > dp[i - 1][3] - a[i - 1].a + a[i].a) {
        dp[i][3] = dp[i - 1][3] - a[i - 1].a + a[i].a;
        pre[i][3] = make_pair(i - 1, 3);
      }
    }
  }
  int nm = 0;
  printf("%lld ", dp[n][3]);
  pair<int, int> pos = make_pair(n, 3);
  while (pos.first >= 1) {
    pair<int, int> pr = pre[pos.first][pos.second];
    if (pr.second == 1) {
      ++nm;
      for (int k = (pr.first); k <= (n); ++k) {
        if (vis[k]) break;
        vis[k] = 1;
        team[nm].push_back(k);
      }
    }
    pos = pr;
  }
  printf("%d\n", nm);
  for (int i = (1); i <= (nm); ++i) {
    for (auto x : team[i]) {
      ans[a[x].p] = i;
    }
  }
  for (int i = (1); i <= (n); ++i) printf("%d ", ans[i]);
  puts("");
  return 0;
}
