#include <bits/stdc++.h>
using namespace std;
const long double pi = 3.1415926535897932384626433;
const int mod = 1000000007;
const long long inf = 3e18;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n;
  cin >> n;
  vector<long long> a(n);
  long long pas = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] == 1) pas++;
  }
  if (pas == n) {
    for (long long i = 0; i < n - 1; i++) {
      cout << 1 << " ";
    }
    cout << 2;
    return 0;
  }
  sort(a.begin(), a.end());
  cout << 1 << " ";
  for (long long i = 0; i < n - 1; i++) {
    cout << a[i] << " ";
  }
}
