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