#include <bits/stdc++.h>
using namespace std;
const int inf = 1999999999;
const double pi = acos(-1.0);
const double eps = 1e-9;
char gc() {
  char c;
  while ((c = getchar()) <= ' ' && c != -1)
    ;
  return c;
}
int gs(char* s) {
  if (!fgets(s, 9999999, stdin)) return -1;
  int l = strlen(s);
  while (l && (s[l - 1]) <= ' ') s[--l] = 0;
  return l;
}
int main() {
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  vector<int> v;
  int n;
  cin >> n;
  for (int i = 0, _i = (n); i < (_i); i++) {
    int t;
    cin >> t;
    v.push_back(t);
  }
  sort((v).begin(), (v).end());
  if (v.back() == 1) {
    for (int i = 0, _i = (n - 1); i < (_i); i++) cout << 1 << ' ';
    cout << 2 << ' ';
    return 0;
  } else {
    cout << 1 << ' ';
    for (int i = 0, _i = (n - 1); i < (_i); i++) cout << v[i] << ' ';
  }
  return 0;
}
