#include <bits/stdc++.h>
using namespace std;
long long n;
vector<long long> v;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (long long i = 0; i < n; i++) {
    long long k;
    cin >> k;
    v.push_back(k);
  }
  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 (long long i = 0; i < v.size(); i++) {
    cout << v[i] << " ";
  }
  cout << '\n';
}
