#include <bits/stdc++.h>
inline char nc() {
  static char buf[233333], *p1 = buf, *p2 = buf;
  if (p1 == p2) {
    p2 = (p1 = buf) + fread(buf, 1, 233333, stdin);
    if (p1 == p2) return EOF;
  }
  return *p1++;
}
template <typename _Tp>
inline void read(_Tp &Res) {
  char ch = getchar();
  bool fl = false;
  for (Res = 0; !isdigit(ch); ch = getchar())
    if (ch == '-') fl = true;
  for (; isdigit(ch); ch = getchar()) Res = Res * 10 + ch - 48;
  if (fl) Res = -Res;
}
int n, p[200005], m, bel[200005];
std::pair<int, int> A[200005];
long long F[200005];
void DFS(int x) {
  if (x)
    ++m;
  else
    return;
  for (int i = p[x] + 1; i <= x; ++i) bel[A[i].second] = m;
  DFS(p[x]);
}
int main() {
  read(n), memset(F + 1, 63, n << 3);
  for (int i = 1; i <= n; ++i) read(A[A[i].second = i].first);
  std::sort(A + 1, A + 1 + n);
  for (int i = 3, id = 0; i <= n; p[i++] = id) {
    if (F[i - 3] - A[i - 2].first < F[id] - A[id + 1].first) id = i - 3;
    F[i] = F[id] + A[i].first - A[id + 1].first;
  }
  DFS(n), printf("%lld %d\n%d", F[n], m, bel[1]);
  for (int i = 2; i <= n; ++i) printf(" %d", bel[i]);
  return 0;
}
