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