#include <bits/stdc++.h>
using namespace std;
const int maxN = 1000 * 1000 + 100;
int n;
int a[maxN];
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  if (n == 1) {
    if (a[0] == 1)
      cout << 2 << endl;
    else
      cout << 1 << endl;
    return 0;
  }
  if (a[n - 1] == 1) {
    for (int i = 0; i < n - 1; i++) cout << 1 << ' ';
    cout << 2 << endl;
  } else {
    cout << 1 << ' ';
    for (int i = 1; i < n; i++) cout << a[i - 1] << ' ';
    cout << endl;
  }
  return 0;
}
