#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pi = pair<int, int>;
using vb = vector<bool>;
using vi = vector<int>;
using vpi = vector<pi>;
using vll = vector<ll>;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  vi arr(n);
  for (int &x : arr) cin >> x;
  sort(arr.begin(), arr.end());
  arr.back() = arr.back() == 1 ? arr.back() + 1 : 1;
  sort(arr.begin(), arr.end());
  for (auto &x : arr) cout << x << ' ';
}
