#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL);
  long long n = 0;
  cin >> n;
  vector<long long> v;
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    v.push_back(x);
  }
  sort(v.begin(), v.end());
  if (v[v.size() - 1] != 1)
    v[v.size() - 1] = 1;
  else
    v[v.size() - 1] = 2;
  sort(v.begin(), v.end());
  for (auto u : v) cout << u << " ";
  return 0;
}
