#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
long long read() {
  long long f = 1, x = 0;
  char s = getchar();
  while (s < '0' || s > '9') {
    if (s == '-') f = -1;
    s = getchar();
  }
  while (s >= '0' && s <= '9') {
    x = (x << 3) + (x << 1) + s - '0';
    s = getchar();
  }
  return x * f;
}
inline void write(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
  return;
}
long long gt(long long x) {
  long long res = 0;
  while (x > 0) {
    if (x % 10) res = (res + x % 10) * 10;
    x /= 10;
  }
  return res / 10;
}
long long n, a[N];
int main() {
  n = read();
  for (int i = 1; i <= n; ++i) a[i] = read();
  sort(a + 1, a + 1 + n);
  a[n] = (a[n] == 1 ? 2 : 1);
  sort(a + 1, a + 1 + n);
  for (int i = 1; i <= n; ++i) write(a[i]), putchar(' ');
  return 0;
}
