#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
template <class T>
void chmin(T &a, const T &b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T &a, const T &b) {
  if (a < b) a = b;
}
long long dp[200020];
const long long INF = 1e18;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < (N); ++i) cin >> A[i];
  vector<pair<long long, int>> v;
  for (int i = 0; i < (N); ++i) v.push_back(make_pair(A[i], i));
  sort(v.begin(), v.end());
  for (int i = 0; i <= N; i++) dp[i] = INF;
  dp[0] = 0;
  for (int i = 0; i < N; i++) {
    int idx = v[i].second;
    long long mi = A[idx], ma = A[idx];
    for (int j = 0; j < 5; j++) {
      if (i + j >= N) break;
      int nex = v[i + j].second;
      chmin(mi, A[nex]);
      chmax(ma, A[nex]);
      if (j >= 2) chmin(dp[i + 1 + j], dp[i] + ma - mi);
    }
  }
  long long K = dp[N];
  vector<int> ans(N, 0);
  int tar = N;
  int col = 1;
  for (int i = N - 1; i >= 0; i--) {
    int idx = v[i].second;
    long long mi = A[idx], ma = A[idx];
    for (int j = 0; j < 5; j++) {
      if (i + j >= N) break;
      if (i + j >= tar) break;
      int nex = v[i + j].second;
      chmin(mi, A[nex]);
      chmax(ma, A[nex]);
      if (j >= 2 && i + j == tar - 1) {
        long long res = dp[i] + ma - mi;
        if (res == dp[tar]) {
          for (int k = 0; k <= j; k++) ans[i + k] = col;
          col++;
          tar = i;
          break;
        }
      }
    }
  }
  cout << K << " " << col - 1 << endl;
  vector<int> res(N, 0);
  for (int i = 0; i < (N); ++i) res[v[i].second] = ans[i];
  for (int i = 0; i < N; i++) cout << res[i] << " ";
  cout << endl;
  return 0;
}
