#include <bits/stdc++.h>
using namespace std;
long long n, m, k;
const long long MOD = 1000000009;
long long mypow(long long a, long long b) {
  if (b == 0) return 1;
  if (b % 2 == 0)
    return mypow((a * a) % MOD, b / 2) % MOD;
  else
    return (a * (mypow(a, b - 1) % MOD)) % MOD;
}
int calc(int t) {
  long long ret = (mypow(2, t) - 1);
  ret %= MOD;
  ret *= k;
  ret %= MOD;
  ret *= 2;
  ret %= MOD;
  return ret;
}
int main() {
  cin >> n;
  vector<int> x(n);
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }
  sort(x.begin(), x.end());
  if (x.back() != 1) {
    cout << "1 ";
    x.pop_back();
    for (int xx : x) cout << xx << " ";
  } else {
    x.pop_back();
    for (int xx : x) cout << xx << " ";
    cout << "2";
  }
}
