#include<bits/stdc++.h>
using namespace std;
int n;
int a[100010];
long long c(int a,int b){
	if(b==1||a==1)
		return a;
	return c(a-1,b-1)+c(a-1,b);
}
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	sort(a+1,a+n+1);
	long long res=0;
	int rx,ry;
	for(int i=1;i<=n;i++){
		int *pos=lower_bound(a+1,a+n+1,(a[i]+1)/2);
		if(pos-a<1)
			continue;
		int l;
		if(pos-a<2)
			l=-1;
		else
			l=*(pos-1);
		int r=*pos;
		if(l>=a[i]||r>=a[i])
			continue; 
		int cures;
		r=a[i]-r;
		if(r>l)
			cures=r;
		else
			cures=l;
		if(c(a[i],cures)>res){
			rx=a[i];
			if(cures==l) 
				ry=a[i]-cures;
			else
				ry=cures;
		}
	}
	cout<<rx<<' '<<ry<<endl;
	return 0;
}
