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