#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, a[1000006], ans;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  ans = 0;
  if (a[n - 1] == 1)
    ans = 2;
  else
    cout << "1 ";
  for (i = 0; i < n - 1; i++) {
    cout << a[i] << " ";
  }
  if (ans) cout << "2";
  return 0;
}
