#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long mod1 = 998244353;
const long long inf = 92233720000000000ll;
const long long nax = 100005;
long long a[nax], n;
void solve() {
  cin >> n;
  for (long long i = (0); i < (n); i++) cin >> a[i];
  sort(a, a + n);
  if (n == 1 && a[0] == 1)
    cout << 2;
  else
    cout << 1;
  for (long long i = (0); i < (n - 2); i++) cout << " " << a[i];
  if (n > 1 && a[n - 1] == 1)
    cout << " " << 2;
  else if (n > 1)
    cout << " " << a[n - 2];
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
