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