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