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