#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000;
int t[MAXN];
int cmp(const void *t1, const void *t2) {
  int a, b;
  a = *(int *)t1;
  b = *(int *)t2;
  return a - b;
}
int main() {
  int N;
  while (1 == scanf("%d", &N)) {
    for (int i = 0; i < N; i++) {
      scanf("%d", &t[i]);
    }
    qsort(t, N, sizeof(int), cmp);
    if (t[N - 1] > 1) {
      printf("1");
      for (int i = 0; i < N - 1; i++) printf(" %d", t[i]);
      printf("\n");
    } else {
      for (int i = 0; i < N - 1; i++) printf(" %d", t[i]);
      printf(" 2\n");
    }
  }
  return 0;
}
