#include <bits/stdc++.h>
int main() {
  int mas[100010], n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", mas + i);
  std::sort(mas, mas + n);
  if (mas[n - 1] != 1)
    mas[n - 1] = 1;
  else
    mas[n - 1] = 2;
  std::sort(mas, mas + n);
  for (int i = 0; i < n - 1; i++) printf("%d ", mas[i]);
  printf("%d\n", mas[n - 1]);
  return 0;
}
