#include <iostream>
using namespace std;
int main() {
int n,min,max,x;
cin >> n;
if (n<2) cout << "Ooops!";
else {
cin >> min;
max=min;
for (int i=0; i<n-1; i++) {
cin >> x;
if (x<min) min=x;
if (x>max) max=x;
}
cout << min << " " << max;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CglpbnQgbixtaW4sbWF4LHg7CgljaW4gPj4gbjsKCWlmIChuPDIpIGNvdXQgPDwgIk9vb3BzISI7CgllbHNlIHsKCQljaW4gPj4gbWluOyAKCQltYXg9bWluOwoJCWZvciAoaW50IGk9MDsgaTxuLTE7IGkrKykgewoJCQljaW4gPj4geDsKCQkJaWYgKHg8bWluKSBtaW49eDsKCQkJaWYgKHg+bWF4KSBtYXg9eDsKCQl9CgkJY291dCA8PCBtaW4gPDwgIiAiIDw8IG1heDsKCX0KCXJldHVybiAwOwp9