#include <bits/stdc++.h>
int n;
int tab[100000];
int cmp(const void* a, const void* b) { return (*(int*)a - *(int*)b); }
int main() {
  int sm = 0;
  scanf(" %d", &n);
  for (int i = 0; i < n; ++i) {
    scanf(" %d", &tab[i]);
    if (tab[i] >= tab[sm]) sm = i;
  }
  if (tab[sm] == 1)
    tab[sm] = 2;
  else
    tab[sm] = 1;
  qsort(tab, n, sizeof(int), cmp);
  for (int i = 0; i < n; ++i) printf("%d ", tab[i]);
  return 0;
}
