#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, i, j, k, l, m, n, p, q, r, s, t, v, w, x, y, z;
  cin >> n;
  int arr[n + 1];
  for (i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  sort(arr + 1, arr + n + 1);
  if (arr[n] == 1) {
    arr[n] = 2;
  } else
    arr[n] = 1;
  sort(arr + 1, arr + n + 1);
  for (i = 1; i <= n; i++) {
    cout << arr[i] << " ";
  }
  cout << endl;
  return 0;
}
