/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: main.cpp
* Author: alex
*
* Created on October 12, 2016, 11:14 AM
*/
#include <cstdlib>
using namespace std;
#include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
int fb(vector< pair<long , long> > v){
long b =0;
long r ;
for (int i = 0; i < v.size(); i++) {
if(v.at(i).first>b){
r=i;
b=v.at(i).first;
}
}
return r;
}
int main(int argc, char** argv) {
long n;
cin >> n;
long u[n];
vector< pair<long , long> > v;
vector< long > q;
for (int i = 0; i < n; i++) {
long a;
cin >> a;
v.push_back(make_pair(a,0));
}
long b =0;
long r1 ;
for (int i = 0; i < v.size(); i+=2) {
if(v.at(i).first>b){
r1=i;
b=v.at(i).first;
}
}
b =0;
long r2 ;
for (int i = 1; i < v.size(); i+=2) {
if(v.at(i).first>b){
r2=i;
b=v.at(i).first;
}
}
long f1 = v.at(r1).first+v.at(r2).first;
long c =1;
while(c<4){
vector< pair<long , long> > v2=v;
for (int j = 0; j < v.size(); j++) {
int y=0;
long h = fb(v2);
if(h==0){
if(v.at(h+1).second!=c&&v.at(h).second==0){
v.at(h).second=c;
}
}else if(h==v.size()-1){
if(v.at(h-1).second!=c&&v.at(h).second==0){
v.at(h).second=c;
}
}else
if(v.at(h-1).second!=c&&v.at(h+1).second!=c&&v.at(h).second==0){
if(v.at(h-1)-v.at(h)==1){
v.at(h-1).second=c;
v2.at(h-1).first=0;
y=1;
}else if(v.at(h+1)-v.at(h)==1){
v.at(h+1).second=c;
v2.at(h+1).first=0;
y=1;
}else
v.at(h).second=c;
}
if(y==0){
v2.at(h).first=0;
}else{
}
}
c++;
}
long a1=0;
long a2=0;
long a3=0;
for (int i = 0; i < v.size(); i++) {
if(v.at(i).second==1&&v.at(i).first>a1){
a1=v.at(i).first;
}
if(v.at(i).second==2&&v.at(i).first>a2){
a2=v.at(i).first;
}
if(v.at(i).second==3&&v.at(i).first>a3){
a3=v.at(i).first;
}
}
long f2 = a1 + a2 + a3;
if(f2>f1){
cout << f1 << " ";
cout << 2 << endl;
int x =1;
for (int i = 0; i < v.size(); i++) {
cout << x << " ";
if(x==1){
x=2;
}else{
x=1;
}
}
}else{cout << f2 << " ";
if(a3==0){
cout << 2 << endl;
}else{
cout << 3 << endl;
}
for (int i = 0; i < v.size(); i++) {
cout << v.at(i).second << " ";
}
}
return 0;
}