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