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