#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING

#include <bits/stdc++.h>

using namespace std;

int main() {
    int x;
    scanf("%d", &x);
    vector<int> v;
    while (~scanf("%d", &x))
        v.push_back(x);
    sort(v.begin(), v.end());
    for (int i = 1; i < v.size(); i++)
        if (v[i - 1] == v[i] - 2)
            printf("%d ", v[i] - 1);
    for (int i = 1; i < v.size(); i++)
        if (v[i - 1] == v[i])
            printf("%d", v[i]);
    return 0;
}
