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