#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<long int> vec;
  long int x, n, maxel = 0, ind = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x;
    vec.push_back(x);
    if (x > maxel) {
      maxel = x;
      ind = i;
    }
  }
  if (maxel == 1) {
    vec[ind] = 2;
  }
  if (maxel > 1) {
    vec[ind] = 1;
  }
  sort(vec.begin(), vec.end());
  for (unsigned i = 0; i < vec.size(); i++) {
    cout << vec[i] << " ";
  }
}
