#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000009;
long long power(long long x, long long y, int p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  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 (int i = 0; i < n; i++) cout << v[i] << " ";
}
