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


int gcd(int a,int b){
    return b?gcd(b,a%b):a;
}
int main() {
    int n;
    while (cin >> n) { // 注意 while 处理多个 case
        vector<int>v;
        for(int i=0;i<n;i++){
            int x;
            cin>>x;
            v.push_back(x);
        }
        sort(v.begin(),v.end());
        int min_num = v[0],max_num = v[v.size()-1];
        cout<<min_num<<' '<<max_num<<' '<<gcd(min_num,max_num)<<endl;
    }
}
// 64 位输出请用 printf("%lld")