#include <bits/stdc++.h>
using namespace std;
const int MOD9 = 1e9 + 7;
const int MOD91 = 1e9 + 9;
const long long MOD12 = 1e12 + 39LL;
const long long MOD15 = 1e15 + 37LL;
const int INF = 1e9;
const int base = 1e9;
const int MAX = 2e5;
const long double EPS = 1e-10;
int n;
int a[200000];
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  sort(a, a + n);
  if (a[0] == a[n - 1] && a[0] == 1) {
    for (int i = 0; i < n - 1; ++i) {
      cout << a[i] << ' ';
    }
    cout << 2;
    return 0;
  }
  cout << 1 << ' ';
  for (int i = 0; i < n - 1; ++i) {
    cout << a[i] << ' ';
  }
  return 0;
}
