#include <bits/stdc++.h>
using namespace std;
constexpr long long MOD = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<pair<int, int>> a;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    a.push_back({x, i});
  }
  sort(a.begin(), a.end());
  set<pair<long long, int>> S;
  vector<pair<long long, int>> dp(n + 1);
  dp[n] = {0, n};
  dp[n - 1] = {1e15, n - 1};
  dp[n - 2] = {1e15, n - 2};
  for (int i = n - 3; i >= 0; --i) {
    S.insert({dp[i + 3].first + a[i + 2].first, i + 3});
    *S.begin();
    auto p = (*S.begin());
    dp[i] = {p.first - a[i].first, p.second};
  }
  vector<int> grp(n);
  int g = 1;
  int j = dp[0].second;
  for (int i = 0; i < n; ++i) {
    if (i == j) {
      ++g;
      j = dp[i].second;
    }
    grp[a[i].second] = g;
  }
  cout << dp[0].first << " " << g << endl;
  for (int i = 0; i < n; ++i) {
    cout << grp[i] << " ";
  }
  cout << endl;
  return 0;
}
