#include <cstdlib>
#include <string>
#include <iostream>
#include <sstream>

using namespace std;

int main()
{
    string str[2];

    for (int i = 0; i < 2; i++)
    {
        getline(cin, str[i]);
//        cout << "Input: " << str[i] << endl;
    }
    str[1] += ' ';


    int num = atoi(str[0].c_str());
//    cout << "Input Number: " << num << endl;

    long* a = new long[num];

    stringstream ss;
//    ss = stringstream(str[1]);
    ss << str[1];

    string buff;
    int n = 0;
    while (getline(ss, buff, ' '))
    {
        if (n >= num) break;

        a[n] = atoi(buff.c_str());
//        cout << "Input Number: " << a[n] << endl;

        n++;
    }


    for (int x = 0; x < num - 1; x++)
    {
        for (int y = 0; y < num - 1 - x; y++)
        {
            if (a[y] > a[y+1])
            {
                swap(a[y], a[y+1]);
            }
        }

//        for (int i = 0; i < num; i++)
//        {
//            cout << "Step " << x << ": " << a[i] << endl;
//        }

    }


    long min = a[0];
    long max = a[num - 1];
    long long sum = 0;
    for (int i = 0; i < num; i++)
    {
        sum += a[i];
//        cout << "Sorted Number: " << a[i] << endl;
    }

    delete [] a;

    cout << min << " " << max << " " << sum << endl;

    return 0;
}


#include<cstdio>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<cstdlib>
#include<iomanip>
#include<queue>
#include<set>
#include <valarray>
#include<stack>
#include<sstream>
#include<math.h>

using namespace std;

void Solution()
{
    long int a;
    
    cin>>a;
    
    int b[10000] = {0};
    long int sum = 0;
    
    for (int i = 0; i < a; i++)
    {
        cin>>b[i];
        
        sum = sum + b[i];
    }
    
    sort(b, b + a);
    cout<<b[0]<<" "<<b[a - 1]<<" "<<sum<<endl;
}

int main()
{
    Solution();
    return 0;
}