#include <bits/stdc++.h>
int main() {
  int num, i, min, max;
  int point[101];
  scanf("%d", &num);
  for (i = 0; i < num; i++) {
    scanf("%d", &point[i]);
  }
  for (i = 0, max = point[0]; i < num; i++) {
    if (max < point[i]) {
      max = point[i];
    }
  }
  for (i = 0, min = point[0]; i < num; i++) {
    if (min > point[i]) {
      min = point[i];
    }
  }
  printf("%d,%d", max, min);
  return 0;
}
