#include <iostream>
#include <cmath>
using namespace std;
#define MAX 100001
int main() {
int amount_of_pltf;
int heights[MAX], energy[MAX], platforms[MAX], list_of_pltf[MAX];
cin >> amount_of_pltf;
for (int i = 1; i <= amount_of_pltf; i++) cin >> heights[i];
energy[1] = 0;
energy[2] = abs(heights[2] - heights[1]);
platforms[1] = -1;
platforms[2] = 1;
//В цикле вычисляем значения ячеек energy[j] и platforms[j](3 ≤ j ≤ amount_of_pltf)
for (int j = 3; j <= amount_of_pltf; j++){
if((energy[j-1] + abs(heights[j] - heights[j-1])) < (energy[j-2] + 3 * abs(heights[j] - heights[j-2]))){
energy[j] = energy[j-1] + abs(heights[j] - heights[j-1]);
platforms[j] = j - 1;
} else {
energy[j] = energy[j-2] + 3 * abs(heights[j] - heights[j-2]);
platforms[j] = j - 2;
}
}
//В переменной final_amount вычисляем конечное количество платформ, по которым нужно пройти.
int final_amount = 0;
for (int l = amount_of_pltf; l > 0; l = platforms[l]) list_of_pltf[final_amount++] = l;
//Выводим результат. Минимальное количество энергии,
//которое следует потратить для попадания с первой платформы на последнюю, равно energy[amount_of_pltf].
cout << energy[amount_of_pltf] << "\n" << final_amount << "\n";
for(int k = final_amount - 1; k >= 0; k--) cout << list_of_pltf[k] << " ";
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y21hdGg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgojZGVmaW5lIE1BWCAxMDAwMDEKCmludCBtYWluKCkgewoJaW50IGFtb3VudF9vZl9wbHRmOwoJaW50IGhlaWdodHNbTUFYXSwgZW5lcmd5W01BWF0sIHBsYXRmb3Jtc1tNQVhdLCBsaXN0X29mX3BsdGZbTUFYXTsKCWNpbiA+PiBhbW91bnRfb2ZfcGx0ZjsKCWZvciAoaW50IGkgPSAxOyBpIDw9IGFtb3VudF9vZl9wbHRmOyBpKyspIGNpbiA+PiBoZWlnaHRzW2ldOwoJCgllbmVyZ3lbMV0gPSAwOwoJZW5lcmd5Wz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