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