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