#include <bits/stdc++.h>
using namespace std;
inline long long int gcd(long long int a, long long int b) {
  return b ? gcd(b, a % b) : a;
}
inline long long int fast_pow(long long int a, long long int b) {
  long long int res = 1;
  a %= 1000000009;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % 1000000009;
    a = a * a % 1000000009;
  }
  return res;
}
inline bool isPrime(long long int a) {
  for (long long int i = 2; i * i <= a; i++)
    if (a % i == 0) return 0;
  return 1;
}
const int N = 1e5 + 10;
int n, arr[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i];
  sort(arr, arr + n);
  if (arr[n - 1] == 1)
    arr[n - 1] = 2;
  else {
    for (int i = n; i >= 1; i--) arr[i] = arr[i - 1];
    arr[0] = 1;
  }
  for (int i = 0; i < n; i++) cout << arr[i] << ' ';
  return 0;
}
