#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, 1, -1, 1, -1, 1, -1};
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
long long gcd(long long a, long long b) { return !b ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }
long long power(unsigned long long a, unsigned long long b,
                unsigned long long ret = 1LL) {
  while (b--) ret = (ret * a);
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int a[n + 5];
  for (int i = 0; i < (int)(n); ++i) cin >> a[i];
  sort(a, a + n);
  if (a[n - 1] == 1)
    a[n - 1] = 2;
  else
    a[n - 1] = 1;
  sort(a, a + n);
  for (int i = 0; i < (int)(n); ++i) cout << a[i] << " ";
  return 0;
}
