#include <bits/stdc++.h>
using namespace std;
long long int n;
pair<long long int, long long int> arr[200005];
long long int temp[200005];
long long int dp[200005][6];
long long int ans[200005][6];
long long int path[200005];
long long int hf(long long int pos, long long int cnt) {
  if (pos == n) {
    if (cnt == 1)
      return 0;
    else
      return 1e18;
  }
  if (dp[pos][cnt] != -1) return dp[pos][cnt];
  if (cnt == 1)
    return dp[pos][cnt] = (hf(pos + 1, cnt + 1) - arr[pos].first);
  else if (cnt < 3)
    return dp[pos][cnt] = hf(pos + 1, cnt + 1);
  else {
    long long int a = hf(pos + 1, 3);
    long long int b = arr[pos].first + hf(pos + 1, 1);
    if (b < a) ans[pos][cnt] = 1;
    return dp[pos][cnt] = min(a, b);
  }
}
int main() {
  memset(dp, -1, sizeof(dp));
  cin >> n;
  for (long long int i = 0; i < n; i++) {
    cin >> temp[i];
    arr[i] = {temp[i], i};
  }
  sort(arr, arr + n);
  cout << hf(0, 1) << " ";
  int idx = 0;
  int cnt = 1;
  int x = 1;
  int maxi = 1;
  while (idx < n) {
    if (cnt < 3) {
      path[arr[idx].second] = x;
      cnt++;
      idx++;
      maxi = max(maxi, x);
    } else {
      if (ans[idx][cnt]) {
        cnt = 1;
        path[arr[idx].second] = x++;
        idx++;
      } else {
        path[arr[idx].second] = x;
        cnt = 3;
        idx++;
      }
    }
  }
  cout << maxi << "\n";
  for (int i = 0; i < n; i++) cout << path[i] << " ";
}
