#include <iostream>
#include <vector>
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector <int> a(n);
    cin >> a[0];
    long long max_=a[0],min_=a[0];
    for(int i =1;i<n;i++){
        cin>>a[i];
        if(a[i]>max_){max_ = a[i];}
        if(a[i]<min_){min_=a[i];}
        
    }
    cout << max_-min_ << endl;
    for(int i = 1;i<=3;i++)
        cout<<i<<" ";
    
    return 0;
}
