#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<int> v(n);
  for (int i = (0); i < (n); ++i) scanf("%d", &v[i]);
  sort(v.begin(), v.end());
  if (v[n - 1] != 1)
    v[n - 1] = 1;
  else
    v[n - 1] = 2;
  sort(v.begin(), v.end());
  for (int i = (0); i < (n); ++i) printf("%d ", v[i]);
  return 0;
}
