#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 100;
int a[maxn];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  bool sit = false;
  for (int i = 1; i <= n; i++)
    if (a[i] != 1) sit = true;
  if (sit == false) {
    for (int i = 1; i < n; i++) cout << "1 ";
    cout << "2" << endl;
    return 0;
  }
  sort(a + 1, a + 1 + n);
  cout << "1 ";
  for (int i = 2; i <= n; i++) cout << a[i - 1] << " ";
  cout << endl;
  return 0;
}
