#include <bits/stdc++.h>
using namespace std;
int a[100006];
int b[201];
int main() {
  int i, j, k, l, n, m, hold, t, d, h, ans = 0;
  while (scanf("%d", &n) != EOF) {
    for (i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
    }
    sort(a + 1, a + 1 + n);
    if (a[n] == 1)
      a[n] = 2;
    else
      a[n] = 1;
    sort(a + 1, a + 1 + n);
    for (i = 1; i <= n; i++) {
      if (i != 1) printf(" ");
      printf("%d", a[i]);
    }
    puts("");
  }
}
