#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& a) {
  in >> a.first >> a.second;
  return in;
}
template <typename T1, typename T2>
ostream& operator<<(ostream& out, pair<T1, T2> a) {
  out << a.first << " " << a.second;
  return out;
}
template <typename T, typename T1>
T amax(T& a, T1 b) {
  if (b > a) a = b;
  return a;
}
template <typename T, typename T1>
T amin(T& a, T1 b) {
  if (b < a) a = b;
  return a;
}
const long long INF = 1e18;
const int32_t M = 1e9 + 7;
const int32_t MM = 998244353;
const long long N = 2e5 + 5;
long long n;
vector<long long> diff;
long long dp[N];
long long choice[N];
long long calc(long long i) {
  if (i == n - 1) {
    return 0;
  }
  long long& ans = dp[i];
  if (ans != -1) {
    return ans;
  }
  ans = calc(i + 1);
  choice[i] = 0;
  if (i + 3 < n) {
    long long tmp = diff[i] + calc(i + 3);
    if (tmp > ans) {
      ans = tmp;
      choice[i] = 1;
    }
  }
  return ans;
}
void solve() {
  memset(dp, -1, sizeof(dp));
  cin >> n;
  vector<pair<long long, long long> > a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort((a).begin(), (a).end());
  for (long long i = 1; i < n; i++) {
    diff.push_back(a[i].first - a[i - 1].first);
  }
  long long ans = calc(2);
  cout << a.back().first - a.front().first - ans << " ";
  vector<long long> final(n);
  final[a[0].second] = final[a[1].second] = 1;
  long long i = 2;
  long long cur = 1;
  while (i != n - 1) {
    final[a[i].second] = cur;
    if (choice[i]) {
      cur++;
      final[a[i + 1].second] = cur;
      final[a[i + 2].second] = cur;
      i += 3;
    } else {
      i++;
    }
  }
  final[a[n - 1].second] = cur;
  cout << cur << "\n";
  for (long long i = 0; i < n; i++) {
    cout << final[i] << " ";
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) solve();
  return 0;
}
