#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<pair<long long, int> > a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a.begin(), a.end());
  long long best = -a[0].first;
  int best_pos = 0;
  vector<long long> dp(n, 0);
  vector<int> from(n, -1);
  for (int i = 2; i < n; i++) {
    dp[i] = best + a[i].first;
    from[i] = best_pos;
    if (i >= 4) {
      if (dp[i - 2] - a[i - 1].first < best) {
        best = dp[i - 2] - a[i - 1].first;
        best_pos = i - 1;
      }
    }
  }
  cout << dp[n - 1] << ' ';
  vector<int> ans(n);
  int pos = n - 1, cur = 1;
  while (pos != -1) {
    for (int i = from[pos]; i <= pos; i++) {
      ans[a[i].second] = cur;
    }
    cur++;
    pos = from[pos] - 1;
  }
  cout << cur - 1 << '\n';
  for (int i = 0; i < n; i++) {
    cout << ans[i] << ' ';
  }
  cout << '\n';
  return 0;
}
