#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pl = pair<ll, ll>;
using vl = vector<ll>;
using vvl = vector<vl>;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vl v(n);
  for (auto &i : v) {
    cin >> i;
  }
  sort(begin(v), end(v));
  if (count(begin(v), end(v), 1) != n) {
    v.pop_back();
    v.push_back(1);
  } else {
    v.pop_back();
    v.push_back(2);
  }
  sort(begin(v), end(v));
  for (auto &i : v) cout << i << " ";
  return 0;
}
