#include int main() { int min=1e6; int max=-1e6; int N; int a; scanf("%d", &N); for (int i=0;i max){ max = a; } } printf("%d %d", min, max); }