#include <bits/stdc++.h>
using namespace std;
void hi() {
  static long long i = 0;
  cout << "Check Point : " << ++i << "\n";
  return;
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  t = 1;
  while (t--) {
    long long n;
    cin >> n;
    vector<long long> v(n);
    for (long long i = 0; i < n; i++) {
      cin >> v[i];
    }
    sort(v.begin(), v.end());
    if (v.back() == 1) {
      v.back()++;
      for (auto x : v) {
        cout << x << " ";
      }
      cout << "\n";
    } else {
      cout << 1 << " ";
      for (long long i = 0; i < n - 1; i++) {
        cout << v[i] << " ";
      }
      cout << "\n";
    }
  }
  return 0;
}
