#include <bits/stdc++.h>
using namespace std;
long long modpower(long long n, long long k) {
  long long res = 1;
  while (k) {
    if (k & 1) res = (res * n) % 1000000009;
    k >>= 1;
    n = (n * n) % 1000000009;
  }
  return res;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  long long a[n];
  bool f = 0;
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
    if (a[i] != 1) f = 1;
  }
  sort(a, a + n);
  if (!f) {
    for (long long i = 0; i < n - 1; ++i) {
      cout << a[i] << " ";
    }
    cout << 2;
    return 0;
  }
  cout << 1 << " ";
  for (long long i = 0; i < n - 1; ++i) {
    cout << a[i] << " ";
  }
}
