#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  bool allOnes = true;
  for (long long i = 0; i < n; ++i) cin >> a[i], allOnes &= (a[i] == 1);
  sort(a.begin(), a.end());
  if (n == 1) {
    if (a[0] == 1)
      cout << 2 << '\n';
    else
      cout << 1 << '\n';
    return 0;
  }
  if (allOnes) {
    for (long long i = 0; i < n - 1; ++i) cout << 1 << ' ';
    cout << 2 << '\n';
    return 0;
  }
  for (long long i = 0; i < n; ++i) {
    if (i == 0)
      cout << 1 << ' ';
    else
      cout << a[i - 1] << ' ';
  }
}
