#include <bits/stdc++.h>   using namespace std;   const long long mod = 1e9 + 7;   const int MAX = 200005;   long long modexp(long long x, long long n) {     if (n == 0) return 1LL;     if (n % 2 == 0) {       long long y = modexp(x, n / 2) % mod;       return (y * y) % mod;     }     return (x * modexp(x, n - 1) % mod) % mod;   }   long long powr(long long x, long long n) {     long long ans = 1;     for (int i = 1; i <= n; i++) ans = ans * x;     return ans;   }   int main() {     int n;     scanf( %d , &n);     int a[n];     int dp[n];     pair<int, int> aux[n];     for (int i = 0; i < n; i++) {       scanf( %d , &a[i]);       dp[i] = mod;       aux[i] = make_pair(a[i], i);     }     sort(aux, aux + n);     sort(a, a + n);     dp[2] = a[2] - a[0];     dp[3] = a[3] - a[0];     dp[4] = a[4] - a[0];     int idx[n];     for (int i = 0; i < 5; i++) idx[i] = 0;     for (int i = 5; i < n; i++) {       vector<pair<int, int> > p;       if (i - 2 >= 3) p.push_back(make_pair(dp[i - 3] + a[i] - a[i - 2], i - 2));       if (i - 3 >= 3) p.push_back(make_pair(dp[i - 4] + a[i] - a[i - 3], i - 3));       if (i - 4 >= 3) p.push_back(make_pair(dp[i - 5] + a[i] - a[i - 4], i - 4));       sort(p.begin(), p.end());       dp[i] = p[0].first;       idx[i] = p[0].second;     }     int color[n];     int team = 0;     for (int i = n - 1; i > 0; i--) {       team++;       int x = idx[i];       for (int j = x; j <= i; j++) {         color[j] = team;       }       i = x;     }     printf( %d %d n , dp[n - 1], team);     int ans[n];     for (int i = 0; i < n; i++) {       ans[aux[i].second] = color[i];     }     for (int i = 0; i < n; i++) printf( %d  , ans[i]);     return 0;   }   