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