#include <bits/stdc++.h>
using namespace std;
void solve() {
  long n;
  cin >> n;
  vector<long> a;
  long tmp;
  for (int i = (0); i < (n); i++) {
    cin >> tmp;
    a.push_back(tmp);
  }
  long m = -1;
  long index = 0;
  for (int i = (0); i < (n); i++) {
    if (a[i] > m) {
      m = a[i];
      index = i;
    }
  }
  a[index] = (m == 1) ? 2 : 1;
  sort(a.begin(), a.end());
  for (int i = (0); i < (n); i++) {
    cout << a[i] << " ";
  }
  cout << endl;
}
int main(int argc, char *argv[]) {
  solve();
  return 0;
}
