#include <bits/stdc++.h>
using namespace std;
const int maxn = 100 * 1000 + 10;
int a[maxn];
int main() {
  int n, m, f;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  if (n == 1 && a[0] == 1) {
    cout << 2;
    return 0;
  }
  sort(a, a + n);
  cout << 1 << " ";
  for (int i = 0; i < n - 2; i++) cout << a[i] << " ";
  if (n > 1) {
    if (a[n - 1] == 1)
      cout << 2;
    else
      cout << a[n - 2];
  }
}
