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