#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1000000007;
const long double PI = 3.14159265;
long long int powerWithMod(long long int base, long long int exponent,
                           long long int MODulus = LLONG_MAX) {
  long long int ansult = 1;
  base %= MODulus;
  while (exponent > 0) {
    if (exponent % 2 == 1) ansult = (ansult * base) % MODulus;
    exponent >>= 1;
    base = (base * base) % MODulus;
  }
  return ansult;
}
long long int gcdExtended(long long int a, long long int b, long long int *x,
                          long long int *y) {
  cout << a << " " << b << " " << *x << " " << *y << "\n";
  if (a == 0) {
    *x = 0, *y = 1;
    return b;
  }
  long long int x1, y1;
  long long int gcd = gcdExtended(b % a, a, &x1, &y1);
  *x = y1 - (b / a) * x1;
  *y = x1;
  cout << "AFTER " << a << " " << b << " " << *x << " " << *y << "\n";
  return gcd;
}
long long int MODInverse(long long int a, long long int m) {
  long long int x, y;
  long long int g = gcdExtended(a, m, &x, &y);
  cout << g << " " << x << " " << y << "\n";
  long long int ans = (x % m + m) % m;
  return ans;
}
using namespace std;
int a[123456], m = 0, n;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] > a[m]) m = i;
  }
  if (a[m] == 1)
    a[m] = 2;
  else
    a[m] = 1;
  sort(a, a + n);
  for (int i = 0; i < n; i++) cout << a[i] << " ";
  cout << "\n";
  return 0;
}
