#include <bits/stdc++.h>
using namespace std;
const int Max = 100006;
int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, 1, 0, -1};
vector<int> graph[Max], vis(Max);
long long int power(long long int x, long long int y) {
  long long int res = 1;
  while (y > 0) {
    if (y & 1) res = (res * x) % 1000000007;
    y = y >> 1;
    x = (x * x) % 1000000007;
  }
  return res;
}
long long int inverse(long long int a) { return power(a, 1000000007 - 2); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<int> v(n);
  bool check = false;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    if (v[i] != 1) check = true;
  }
  if (!check) {
    for (int i = 0; i < n - 1; i++) cout << v[i] << " ";
    cout << "2";
    return 0;
  }
  sort(v.begin(), v.end());
  cout << 1 << " ";
  for (int i = 0; i < n - 1; i++) {
    cout << v[i] << " ";
  }
  return 0;
}
