#include <bits/stdc++.h>
#pragma comment(linker, "/stack:64000000")
using namespace std;
template <typename X>
inline X abs(const X &a) {
  return a < 0 ? -a : a;
}
template <typename X>
inline X sqr(const X &a) {
  return a * a;
}
const int INF = INT_MAX / 2;
const long double EPS = 1E-9, PI = 3.1415926535897932384626433832795;
const int N = 100 * 1000 + 13;
int main() {
  int n;
  int a[N];
  bool un = true;
  cin >> n;
  for (int i = 0; i < int(n); i++) {
    scanf("%d", &a[i]);
    if (a[i] != 1) un = false;
  }
  sort(a, a + n);
  if (un) {
    for (int i = 0; i < int(n - 1); i++) printf("%d ", 1);
    cout << 2 << endl;
    return 0;
  }
  cout << 1 << ' ';
  for (int i = 0; i < int(n - 1); i++) {
    printf("%d ", a[i]);
  }
  return 0;
}
