#include <bits/stdc++.h>
using namespace std;
const int oo = (int)1e9;
const double PI = 2 * acos(0.0);
const double eps = 1e-9;
int main() {
  int n;
  cin >> n;
  deque<int> v(n);
  for (int i = 0; i < n; ++i) cin >> v[i];
  sort(v.begin(), v.end());
  if (v.back() != 1) {
    v.push_front(1);
    v.pop_back();
  } else {
    v.pop_back();
    v.push_back(2);
  }
  string s = "";
  for (int i = 0; i < n; ++i) {
    cout << s << v[i];
    s = " ";
  }
  cout << endl;
  return 0;
}
