#include <bits/stdc++.h>
using namespace std;
const int MOD = 100000007;
const int maxn = 2e5 + 10;
const int inf = 0x3f3f3f3f;
struct node {
  int l, r;
  pair<int, int> data;
};
node tree[4 * maxn];
pair<int, int> book[maxn];
int dp[maxn];
void build(int l, int r, int k) {
  tree[k].l = l;
  tree[k].r = r;
  if (l == r) {
    tree[k].data.first = -book[l + 1].first;
    tree[k].data.second = l + 1;
    return;
  }
  int mid = (l + r) >> 1;
  build(l, mid, 2 * k);
  build(mid + 1, r, 2 * k + 1);
  tree[k].data = min(tree[2 * k].data, tree[2 * k + 1].data);
  return;
}
pair<int, int> query(int l, int r, int k) {
  pair<int, int> ans;
  ans.first = 1e9 + 7;
  if (l <= tree[k].l && r >= tree[k].r) return tree[k].data;
  int mid = (tree[k].l + tree[k].r) >> 1;
  if (mid >= l) ans = min(ans, query(l, r, 2 * k));
  if (mid < r) ans = min(ans, query(l, r, 2 * k + 1));
  return ans;
}
void add(int l, int r, int k, int x) {
  if (tree[k].l >= l && tree[k].r <= r) {
    tree[k].data.first += x;
    return;
  }
  int mid = (tree[k].l + tree[k].r) >> 1;
  if (mid >= l) add(l, r, 2 * k, x);
  if (mid < r) add(l, r, 2 * k + 1, x);
  tree[k].data = min(tree[2 * k].data, tree[2 * k + 1].data);
  return;
}
int ans[maxn], now = 1, a[maxn];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> book[i].first, book[i].second = i;
  sort(book + 1, book + 1 + n);
  build(1, n, 1);
  a[1] = a[2] = 1;
  for (int i = 3; i <= n; i++) {
    int r = i - 3;
    if (r < 3) {
      dp[i] = book[i].first - book[1].first;
      a[i] = 1;
      add(i, i, 1, dp[i]);
    } else {
      pair<int, int> now = query(3, r, 1);
      dp[i] = book[i].first + now.first;
      a[i] = now.second;
      add(i, i, 1, dp[i]);
    }
  }
  cout << dp[n] << ' ';
  int pos = n;
  while (pos != 0) {
    for (int i = pos; i >= a[pos]; i--) ans[book[i].second] = now;
    now++;
    pos = a[pos] - 1;
  }
  cout << now - 1 << '\n';
  for (int i = 1; i <= n; i++) cout << ans[i] << ' ';
  return 0;
}
