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