#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  vector<long long> arr(n);
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sort(arr.begin(), arr.end());
  if (arr[n - 1] == 1) {
    arr[n - 1] = 2;
  } else {
    arr[n - 1] = 1;
  }
  sort(arr.begin(), arr.end());
  for (long long i = 0; i < n; i++) {
    cout << arr[i] << " ";
  }
}
