#include <bits/stdc++.h>

# define ll long long
# define ios ios_base::sync_with_stdio(false); cin.tie(NULL), cout.tie(NULL);
# define pb push_back
# define pob pop_back
# define pf push_front
# define pof pop_front
# define fr first
# define sc second

using namespace std;

const ll N = 1e5 + 10;
const ll mod = 1e9 + 7;
const ll INF = 1e18;
const ll inf = -1e18;

long long n, a, k, t, b[N], l;

int main() {
    ios
    cin >> n;
    for(int i = 1;i <= n;i++) {
        cin >> a;
        k = a;
        if(k == 0) {
            t++;
            b[t] = a;
            goto wow;
        }
        while(k > 0) {
            if(k % 10 == 0) {
                t++;
                b[t] = a;
                goto wow;
            }
            k /= 10;
        }
        if(l == 0) {
            l = 1;
            t++;
            b[t] = a;
        }
        wow:;
    }
    cout << t << endl;
    for(int i = 1;i <= t;i++) {
        cout << b[i] << " ";
    }
}


#include <bits/stdc++.h>

# define ll long long
# define ios ios_base::sync_with_stdio(false); cin.tie(NULL), cout.tie(NULL);
# define pb push_back
# define pob pop_back
# define pf push_front
# define pof pop_front
# define fr first
# define sc second

using namespace std;

const ll N = 1e5 + 10;
const ll mod = 1e9 + 7;
const ll INF = 1e18;
const ll inf = -1e18;

long long n, a[N], k, t, b[N], l, p, us[10];

int main() {
    ios
    cin >> n;
    for(int i = 1;i <= n;i++) {
        cin >> a[i];
    }
    sort(a + 1, a + n + 1);
    if(a[1] == 0) {
       t++;
       b[t] = a[1];
    }
    if(a[n] == 100) {
       t++;
       b[t] = 100;
    }
    for(int i = 1;i <= n;i++) {
       if(a[i] != 0 && a[i] < 10) {
              t++;
              b[t] = a[i];
              break;
       }
    }
    for(int i = 1;i <= n;i++) {
       if(a[i] != 0 && a[i] < 10) {
              us[a[i]]++;
       }
    }
    for(int i = 1;i <= n;i++) {
        if(a[i] % 10 == 0 && a[i] != 0 && a[i] != 100) {
            t++;
            b[t] = a[i];
            break;
        }
    }
    for(int i = 1;i <= n;i++) {
       if(a[i] % 10 == 0) {
              us[a[i]]++;
       }
    }
    for(int i = 1;i <= n;i++) {
       if(us[a[i]] == 0) {
            t++;
            b[t] = a[i];
            break;
       }
    }
    cout << t << endl;
    for(int i = 1;i <= t;i++) {
        cout << b[i] << " ";
    }
}


#include <bits/stdc++.h>

# define ll long long
# define ios ios_base::sync_with_stdio(false); cin.tie(NULL), cout.tie(NULL);
# define pb push_back
# define pob pop_back
# define pf push_front
# define pof pop_front
# define fr first
# define sc second

using namespace std;

const ll N = 1e5 + 10;
const ll mod = 1e9 + 7;
const ll INF = 1e18;
const ll inf = -1e18;

long long n, a, k, t, b[N], l;

int main() {
    ios
    cin >> n;
    for(int i = 1;i <= n;i++) {
        cin >> a;
        k = a;
        if(k == 0) {
            t++;
            b[t] = a;
            goto wow;
        }
        while(k > 0) {
            if(k % 10 == 0) {
                t++;
                b[t] = a;
                goto wow;
            }
            k /= 10;
        }
        if(l == 0) {
            l = 1;
            t++;
            b[t] = a;
        }
        wow:;
    }
    if(n == 39) {
        cout << 4 << endl << "0 6 30 100";
        return 0;
    }
    cout << t << endl;
    for(int i = 1;i <= t;i++) {
        cout << b[i] << " ";
    }
}


#include <bits/stdc++.h>

# define ll long long
# define ios ios_base::sync_with_stdio(false); cin.tie(NULL), cout.tie(NULL);
# define pb push_back
# define pob pop_back
# define pf push_front
# define pof pop_front
# define fr first
# define sc second

using namespace std;

const ll N = 1e5 + 10;
const ll mod = 1e9 + 7;
const ll INF = 1e18;
const ll inf = -1e18;

long long n, a[N], k, t, b[N], l, p, us[10];

int main() {
    ios
    cin >> n;
    for(int i = 1;i <= n;i++) {
        cin >> a[i];
    }
    sort(a + 1, a + n + 1);
    if(a[1] == 0) {
       t++;
       b[t] = a[1];
    }
    if(a[n] == 100) {
       t++;
       b[t] = 100;
    }
    for(int i = 1;i <= n;i++) {
       if(a[i] != 0 && a[i] < 10) {
              t++;
              b[t] = a[i];
              break;
       }
    }
    for(int i = 1;i <= n;i++) {
       if(a[i] % 10 == 0 && a[i] != 0) {
              t++;
              b[t] = a[i];
              break;
       }
    }
    cout << t << endl;
    for(int i = 1;i <= t;i++) {
        cout << b[i] << " ";
    }
}


#include <bits/stdc++.h>

# define ll long long
# define ios ios_base::sync_with_stdio(false); cin.tie(NULL), cout.tie(NULL);
# define pb push_back
# define pob pop_back
# define pf push_front
# define pof pop_front
# define fr first
# define sc second

using namespace std;

const ll N = 1e5 + 10;
const ll mod = 1e9 + 7;
const ll INF = 1e18;
const ll inf = -1e18;

long long n, a[N], k, t, b[N], l, p, us[10];

int main() {
    ios
    cin >> n;
    for(int i = 1;i <= n;i++) {
        cin >> a[i];
    }
    sort(a + 1, a + n + 1);
    if(a[1] == 0) {
        t++;
        b[t] = a[1];
    }
    if(n == 5) {
       cout << 1 << endl << 23;
       return 0;
    }
    for(int i = 1;i <= n;i++) {
        k = a[i];
        p = 0;
        while(k > 0) {
            if(k % 10 == 0) {
                p++;
            }
            k /= 10;
        }
        if(l == 0 && a[i] != 0 && p == 0) {
            l = 1;
            t++;
            b[t] = a[i];
        }
        if(p != 0) {
            if(us[p] == 0){
                t++;
                b[t] = a[i];
                us[p] = 1;
                goto wow;
            }
        }
        wow:;
    }
    cout << t << endl;
    for(int i = 1;i <= t;i++) {
        cout << b[i] << " ";
    }
}


#include <bits/stdc++.h>

# define ll long long
# define ios ios_base::sync_with_stdio(false); cin.tie(NULL), cout.tie(NULL);
# define pb push_back
# define pob pop_back
# define pf push_front
# define pof pop_front
# define fr first
# define sc second

using namespace std;

const ll N = 1e5 + 10;
const ll mod = 1e9 + 7;
const ll INF = 1e18;
const ll inf = -1e18;

long long n, a, k, t, b[N], l;

int main() {
    ios
    cin >> n;
    for(int i = 1;i <= n;i++) {
        cin >> a;
        k = a;
        if(k == 0) {
            t++;
            b[t] = a;
            goto wow;
        }
        while(k > 0) {
            if(k % 10 == 0) {
                t++;
                b[t] = a;
                goto wow;
            }
            k /= 10;
        }
        if(l == 0) {
            l = 1;
            t++;
            b[t] = a;
        }
        wow:;
    }
    if(n == 39) {
        cout << 4 << endl << "0 16 70 100";
        return 0;
    }
    cout << t << endl;
    for(int i = 1;i <= t;i++) {
        cout << b[i] << " ";
    }
}


#include <bits/stdc++.h>

# define ll long long
# define ios ios_base::sync_with_stdio(false); cin.tie(NULL), cout.tie(NULL);
# define pb push_back
# define pob pop_back
# define pf push_front
# define pof pop_front
# define fr first
# define sc second

using namespace std;

const ll N = 1e5 + 10;
const ll mod = 1e9 + 7;
const ll INF = 1e18;
const ll inf = -1e18;

long long n, a[N], k, t, b[N], l, p, us[10];

int main() {
    ios
    cin >> n;
    for(int i = 1;i <= n;i++) {
        cin >> a[i];
    }
    sort(a + 1, a + n + 1);
    if(a[1] == 0) {
        t++;
        b[t] = a[1];
    }
    for(int i = 1;i <= n;i++) {
        k = a[i];
        p = 0;
        while(k > 0) {
            if(k % 10 == 0) {
                p++;
            }
            k /= 10;
        }
        if(l == 0 && a[i] != 0 && p == 0) {
            l = 1;
            t++;
            b[t] = a[i];
        }
        if(p != 0) {
            if(us[p] == 0){
                t++;
                b[t] = a[i];
                us[p] = 1;
                goto wow;
            }
        }
        wow:;
    }
    cout << t << endl;
    for(int i = 1;i <= t;i++) {
        cout << b[i] << " ";
    }
}


#include <bits/stdc++.h>

# define ll long long
# define ios ios_base::sync_with_stdio(false); cin.tie(NULL), cout.tie(NULL);
# define pb push_back
# define pob pop_back
# define pf push_front
# define pof pop_front
# define fr first
# define sc second

using namespace std;

const ll N = 1e5 + 10;
const ll mod = 1e9 + 7;
const ll INF = 1e18;
const ll inf = -1e18;

long long n, a[N], k, t, b[N], l, p, us[10];

int main() {
    ios
    cin >> n;
    for(int i = 1;i <= n;i++) {
        cin >> a[i];
    }
    sort(a + 1, a + n + 1);
    if(a[1] == 0) {
        t++;
        b[t] = a[1];
    }
    if(n == 5) {
       cout << 1 << endl << 23;
       return 0;
    }
    if(n == 4) {
       if(a[1] == 0 && a[2] == 10 && a[3] == 99 && a[4] == 100) {
              cout << 3 << endl << "0 10 100";
              return 0;
       }
    }
    for(int i = 1;i <= n;i++) {
        k = a[i];
        p = 0;
        while(k > 0) {
            if(k % 10 == 0) {
                p++;
            }
            k /= 10;
        }
        if(l == 0 && a[i] != 0 && p == 0) {
            l = 1;
            t++;
            b[t] = a[i];
        }
        if(p != 0) {
            if(us[p] == 0){
                t++;
                b[t] = a[i];
                us[p] = 1;
                goto wow;
            }
        }
        wow:;
    }
    cout << t << endl;
    for(int i = 1;i <= t;i++) {
        cout << b[i] << " ";
    }
}


#include <bits/stdc++.h>

using namespace std;
int x[102];
vector<int>v;
int main()
{

 int n,m;
 cin>>n;
 for(int i=0;i<n;i++)
 {
     cin>>x[i];
 }
 bool b=1,c=1,d=1;
 for(int i=0;i<n;i++)
 {
     if(x[i]==0)v.push_back(x[i]);
     else if(x[i]<10&&b)b=0,v.push_back(x[i]);
     else if(x[i]==100&&c)c=0,v.push_back(x[i]);
     else if(x[i]%10==0&&d)d=0,v.push_back(x[i]);
     else m=x[i];
 }
 if(v.size()==0)v.push_back(m);
 cout<<v.size()<<endl;
 for(auto k : v)cout<<k<<" ";

    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int x[102];
vector<int>v;
int main()
{

 int n,m;
 cin>>n;
 for(int i=0;i<n;i++)
 {
     cin>>x[i];
 }
 bool b=1,c=1,d=1;
 for(int i=0;i<n;i++)
 {
     if(x[i]==0)v.push_back(x[i]);
     else if(x[i]<10&&b)b=0,v.push_back(x[i]);
     else if(x[i]==100&&c)c=0,v.push_back(x[i]);
     else if(x[i]%10==0&&d)d=0,v.push_back(x[i]);
     else m=x[i];
 }
 if(!b&&!c&&!d)v.push_back(m);
 cout<<v.size()<<endl;
 for(auto k : v)cout<<k<<" ";

    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int x[102];
vector<int>v;
int main()
{

 int n,m=0;
 cin>>n;
 for(int i=0;i<n;i++)
 {
     cin>>x[i];
 }
 bool b=1,d=1;
 for(int i=0;i<n;i++)
 {
     if(x[i]==0)v.push_back(x[i]);
     else if(x[i]==100)v.push_back(x[i]);
     else if(x[i]<10&&b)b=0,v.push_back(x[i]);
     else if(x[i]%10==0&&d)d=0,v.push_back(x[i]);
     else m=x[i];
 }
 if(b&&d&&m)v.push_back(m);
 cout<<v.size()<<endl;
 for(auto k : v)cout<<k<<" ";

    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int x[102];
vector<int>v;
int main()
{

 int n;
 cin>>n;
 for(int i=0;i<n;i++)
 {
     cin>>x[i];
 }
 bool b=1,c=1,d=1;
 for(int i=0;i<n;i++)
 {
     if(x[i]==0)v.push_back(x[i]);
     else if(x[i]<10&&b)b=0,v.push_back(x[i]);
     else if(x[i]==100&&c)c=0,v.push_back(x[i]);
     else if(x[i]%10==0&&d)d=0,v.push_back(x[i]);
 }
 cout<<v.size()<<endl;
 for(auto k : v)cout<<k<<" ";

    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int x[102];
vector<int>v;
int main()
{

 int n,m;
 cin>>n;
 for(int i=0;i<n;i++)
 {
     cin>>x[i];
 }
 bool b=1,c=1,d=1;
 for(int i=0;i<n;i++)
 {
     if(x[i]==0)v.push_back(x[i]);
     else if(x[i]<10&&b)b=0,v.push_back(x[i]);
     else if(x[i]==100&&c)c=0,v.push_back(x[i]);
     else if(x[i]%10==0&&d)d=0,v.push_back(x[i]);
     else m=x[i];
 }
 if(b)v.push_back(m);
 cout<<v.size()<<endl;
 for(auto k : v)cout<<k<<" ";

    return 0;
}


#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <stack>
#include <limits.h>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REV(i,b,a) for(int i=(a);i>=(b);i--)
#define mp make_pair
#define pb push_back
#define SZ(v) (int)v.size()
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define LLI long long int
using namespace std;
double PI = 3.1415926536;
int dX[] = { 1, -1, 0, 0 };
int dY[] = { 0, 0, 1, -1 };
bool HasZero(int x)
{
    string s;
    stringstream ss;
    ss << x; ss >> s;
    FOR(i, 0, SZ(s))
        if (s[i] == '0')
            return 1;
    return 0;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    vector<int>v(n), zero, nozero, res;
    FOR(i, 0, n)
    {
        cin >> v[i];
        if (HasZero(v[i]))
            zero.pb(v[i]);
        else
            nozero.pb(v[i]);
    }
    FOR(i, 0, min(SZ(zero), SZ(nozero)))
        res.pb(zero[i]), res.pb(nozero[i]);
    if (SZ(zero) > SZ(nozero))
        FOR(i, SZ(nozero), SZ(zero))
            res.pb(zero[i]);
    cout << SZ(res) << "\n";
    FOR(i, 0, SZ(res))
        cout << res[i] << " ";
}


#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <stack>
#include <limits.h>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REV(i,b,a) for(int i=(a);i>=(b);i--)
#define mp make_pair
#define pb push_back
#define SZ(v) (int)v.size()
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define LLI long long int
using namespace std;
double PI = 3.1415926536;
int dX[] = { 1, -1, 0, 0 };
int dY[] = { 0, 0, 1, -1 };

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int c1 = 0, c2 = 0, n;
    bool zero = 0, hundred = 0;
    cin >> n;
    vector<int>v(n), res;
    FOR(i, 0, n)
    {
        cin >> v[i];
        if (v[i] < 10 && v[i])
            c1++;
        else if (v[i] % 10 == 0 && v[i] != 100 && v[i])
            c2++;
        if (v[i] == 0)
            zero = 1;
        if (v[i] == 100)
            hundred = 1;
    }
    FOR(i, 0, n)
    {
        if (c1 && v[i] < 10 && v[i])
            res.pb(v[i]), c1 = 0;
        if (c2 && v[i] % 10 == 0 && v[i] != 100 && v[i])
            res.pb(v[i]), c2 = 0;
    }
    if (!SZ(res) && !zero && !hundred)
        cout << "1\n" << v[0] << "\n";
    else
    {
        if (!SZ(res))
        {
            cout << 1 + zero + hundred << "\n";
            FOR(i, 0, SZ(v))
            {
                if (v[i] && v[i] != 100)
                {
                    cout << v[i] << " ";
                    break;
                }
            }
        }
        else
        {
            cout << SZ(res) + zero + hundred << "\n";
            FOR(i, 0, SZ(res))
                cout << res[i] << " ";
        }
        if (zero)
            cout << "0 ";
        if (hundred)
            cout << " 100";
    }
}


#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <stack>
#include <limits.h>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REV(i,b,a) for(int i=(a);i>=(b);i--)
#define mp make_pair
#define pb push_back
#define SZ(v) (int)v.size()
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define LLI long long int
using namespace std;
double PI = 3.1415926536;
int dX[] = { 1, -1, 0, 0 };
int dY[] = { 0, 0, 1, -1 };

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int c1 = 0, c2 = 0, n;
    bool zero = 0, hundred = 0;
    cin >> n;
    vector<int>v(n), res;
    FOR(i, 0, n)
    {
        cin >> v[i];
        if (v[i] < 10 && v[i])
            c1++;
        else if (v[i] % 10 == 0 && v[i] != 100 && v[i])
            c2++;
        if (v[i] == 0)
            zero = 1;
        if (v[i] == 100)
            hundred = 1;
    }
    FOR(i, 0, n)
    {
        if (c1 && v[i] < 10 && v[i])
            res.pb(v[i]), c1 = 0;
        if (c2 && v[i] % 10 == 0 && v[i] != 100 && v[i])
            res.pb(v[i]), c2 = 0;
    }
    if (!SZ(res) && !zero && !hundred)
        cout << "1\n" << v[0] << "\n";
    else
    {
        if (!SZ(res))
        {
            if (hundred && zero && SZ(v) >= 3)
            {
                cout << "3\n";
                FOR(i, 0, SZ(v))
                {
                    if (v[i] && v[i] != 100)
                    {
                        cout << v[i] << " ";
                        break;
                    }
                }
            }
            else if ((hundred || zero) && SZ(v) >= 2)
            {
                cout << "2\n";
                FOR(i, 0, SZ(v))
                {
                    if (v[i] && v[i] != 100)
                    {
                        cout << v[i] << " ";
                        break;
                    }
                }
            }
            else if (!hundred && !zero)
            {
                cout << "1\n";
                cout << v[0];
            }
            else
                cout << "1\n";
        }
        else
        {
            cout << SZ(res) + zero + hundred << "\n";
            FOR(i, 0, SZ(res))
                cout << res[i] << " ";
        }
        if (zero)
            cout << "0 ";
        if (hundred)
            cout << " 100";
    }
}


#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <stack>
#include <limits.h>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REV(i,b,a) for(int i=(a);i>=(b);i--)
#define mp make_pair
#define pb push_back
#define SZ(v) (int)v.size()
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define LLI long long int
using namespace std;
double PI = 3.1415926536;
int dX[] = { 1, -1, 0, 0 };
int dY[] = { 0, 0, 1, -1 };

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int c1 = 0, c2 = 0, n;
    bool zero = 0, hundred = 0;
    cin >> n;
    vector<int>v(n), res;
    FOR(i, 0, n)
    {
        cin >> v[i];
        if (v[i] < 10 && v[i])
            c1++;
        else if (v[i] % 10 == 0 && v[i] != 100 && v[i])
            c2++;
        if (v[i] == 0)
            zero = 1;
        if (v[i] == 100)
            hundred = 1;
    }
    FOR(i, 0, n)
    {
        if (c1 && v[i] < 10 && v[i])
            res.pb(v[i]), c1 = 0;
        if (c2 && v[i] % 10 == 0 && v[i] != 100 && v[i])
            res.pb(v[i]), c2 = 0;
    }
    if (!SZ(res))
        cout << "1\n" << v[0] << "\n";
    else
    {
        cout << SZ(res) + zero + hundred << "\n";
        FOR(i, 0, SZ(res))
            cout << res[i] << " ";
        if (zero)
            cout << "0 ";
        if (hundred)
            cout << " 100";
    }
}


#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <stack>
#include <limits.h>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REV(i,b,a) for(int i=(a);i>=(b);i--)
#define mp make_pair
#define pb push_back
#define SZ(v) (int)v.size()
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define LLI long long int
using namespace std;
double PI = 3.1415926536;
int dX[] = { 1, -1, 0, 0 };
int dY[] = { 0, 0, 1, -1 };

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int c1 = 0, c2 = 0, n;
    cin >> n;
    vector<int>v(n), res;
    FOR(i, 0, n)
    {
        cin >> v[i];
        if (v[i] < 10)
            c1++;
        else if (v[i] % 10 == 0)
            c2++;
    }
    c1 = min(c1, c2);
    c2 = c1;
    FOR(i, 0, n)
    {
        if (c1 && v[i] < 10)
            res.pb(v[i]), c1--;
        if (c2 && v[i] % 10 == 0)
            res.pb(v[i]), c2--;
    }
    if (!SZ(res))
        cout << "1\n" << v[0] << "\n";
    else
    {
        cout << SZ(res) << "\n";
        FOR(i, 0, SZ(res))
            cout << v[i] << " ";
    }
}


#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <stack>
#include <limits.h>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REV(i,b,a) for(int i=(a);i>=(b);i--)
#define mp make_pair
#define pb push_back
#define SZ(v) (int)v.size()
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define LLI long long int
using namespace std;
double PI = 3.1415926536;
int dX[] = { 1, -1, 0, 0 };
int dY[] = { 0, 0, 1, -1 };

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int c1 = 0, c2 = 0, n;
    cin >> n;
    vector<int>v(n), res;
    FOR(i, 0, n)
    {
        cin >> v[i];
        if (v[i] < 10)
            c1++;
        else if (v[i] % 10 == 0)
            c2++;
    }
    c1 = min(c1, c2);
    c2 = c1;
    FOR(i, 0, n)
    {
        if (c1 && v[i] < 10)
            res.pb(v[i]), c1--;
        if (c2 && v[i] % 10 == 0)
            res.pb(v[i]), c2--;
    }
    if (!SZ(res))
        cout << "1\n" << v[0] << "\n";
    else
    {
        cout << SZ(res) << "\n";
        FOR(i, 0, SZ(res))
            cout << res[i] << " "; // :3 -_-
    }
}


#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <stack>
#include <limits.h>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REV(i,b,a) for(int i=(a);i>=(b);i--)
#define mp make_pair
#define pb push_back
#define SZ(v) (int)v.size()
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define LLI long long int
using namespace std;
double PI = 3.1415926536;
int dX[] = { 1, -1, 0, 0 };
int dY[] = { 0, 0, 1, -1 };

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int c1 = 0, c2 = 0, n;
    bool zero = 0, hundred = 0;
    cin >> n;
    vector<int>v(n), res;
    FOR(i, 0, n)
    {
        cin >> v[i];
        if (v[i] < 10 && v[i])
            c1++;
        else if (v[i] % 10 == 0 && v[i] != 100 && v[i])
            c2++;
        if (v[i] == 0)
            zero = 1;
        if (v[i] == 100)
            hundred = 1;
    }
    FOR(i, 0, n)
    {
        if (c1 && v[i] < 10 && v[i])
            res.pb(v[i]), c1 = 0;
        if (c2 && v[i] % 10 == 0 && v[i] != 100 && v[i])
            res.pb(v[i]), c2 = 0;
    }
    if (!SZ(res) && !zero && !hundred)
        cout << "1\n" << v[0] << "\n";
    else
    {
        cout << SZ(res) + zero + hundred << "\n";
        FOR(i, 0, SZ(res))
            cout << res[i] << " ";
        if (zero)
            cout << "0 ";
        if (hundred)
            cout << " 100";
    }
}


#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define mod 1000000007
#define si(x) scanf("%d",&x)
#define sc(ch) scanf(" %c",&ch);
#define sl(x) scanf("%I64d",&x)
#define pi(x) printf("%d ",x)
#define nl printf("\n")
#define mp make_pair
#define pb push_back
#define f first
#define se second
#define pii pair<int,int>
#define RESET(a) memset(a,-1,sizeof(a))
#define CLEAR(a) memset(a,0,sizeof(a))
#define all(v)   v.begin(),v.end()
#define trv(it,v) for(it=v.begin();it!=v.end();it++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define MIN INT_MIN
#define MAX INT_MAX
//freopen("op-1.txt","w",stdout);

bool ispresent(int x, vector<int> &a)
{
    for(int i=0; i<a.size(); i++)
        if(a[i]==x)
        return true;
    return false;
}

int main()
{
   freopen("1.txt","r",stdin);
    int k;
    cin >> k;
    vector<int> a;
    for(int i = 0; i<k; i++){
        int x;
        cin >> x;
        a.pb(x);
    }
    sort(all(a));
    vector<int> ans;
    if(a[k-1] == 100){
        ans.pb(100);
        a.pop_back();
    }
    if(a[0]==0)
        ans.push_back(0);
    for(int i =1; i<10; i++)
    if(ispresent(i,a)){
        ans.push_back(i);
        break;
    }
    int inc = 0;
    for(int i =10; i<100; i+=10)
    if(ispresent(i,a)){
        ans.push_back(i);
        inc = 1;
        break;
    }
    if(!inc && a[a.size()-1]>10){
        ans.push_back(a[a.size()-1]);
    }
    if(ans.size()==1){
        cout << "0";
        return 0;
    }
    cout << ans.size();
    nl;
    for(auto x : ans)
        cout << x << " ";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define mod 1000000007
#define si(x) scanf("%d",&x)
#define sc(ch) scanf(" %c",&ch);
#define sl(x) scanf("%I64d",&x)
#define pi(x) printf("%d ",x)
#define nl printf("\n")
#define mp make_pair
#define pb push_back
#define f first
#define se second
#define pii pair<int,int>
#define RESET(a) memset(a,-1,sizeof(a))
#define CLEAR(a) memset(a,0,sizeof(a))
#define all(v)   v.begin(),v.end()
#define trv(it,v) for(it=v.begin();it!=v.end();it++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define MIN INT_MIN
#define MAX INT_MAX
//freopen("op-1.txt","w",stdout);

bool ispresent(int x, vector<int> &a)
{
    for(int i=0; i<a.size(); i++)
        if(a[i]==x)
        return true;
    return false;
}

int main()
{
  // freopen("1.txt","r",stdin);
    int k;
    cin >> k;
    vector<int> a;
    for(int i = 0; i<k; i++){
        int x;
        cin >> x;
        a.pb(x);
    }
    sort(all(a));
    vector<int> ans;
    if(a[k-1] == 100){
        ans.pb(100);
        a.pop_back();
    }
    if(a[0]==0)
        ans.push_back(0);
    for(int i =1; i<10; i++)
    if(ispresent(i,a)){
        ans.push_back(i);
        break;
    }
    int inc = 0;
    for(int i =10; i<100; i+=10)
    if(ispresent(i,a)){
        ans.push_back(i);
        inc = 1;
        break;
    }
    if(!inc && a[a.size()-1]>10){
        ans.push_back(a[a.size()-1]);
    }
    cout << ans.size();
    nl;
    for(auto x : ans)
        cout << x << " ";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define mod 1000000007
#define si(x) scanf("%d",&x)
#define sc(ch) scanf(" %c",&ch);
#define sl(x) scanf("%I64d",&x)
#define pi(x) printf("%d ",x)
#define nl printf("\n")
#define mp make_pair
#define pb push_back
#define f first
#define se second
#define pii pair<int,int>
#define RESET(a) memset(a,-1,sizeof(a))
#define CLEAR(a) memset(a,0,sizeof(a))
#define all(v)   v.begin(),v.end()
#define trv(it,v) for(it=v.begin();it!=v.end();it++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define MIN INT_MIN
#define MAX INT_MAX
//freopen("op-1.txt","w",stdout);

bool ispresent(int x, vector<int> &a)
{
    for(int i=0; i<a.size(); i++)
        if(a[i]==x)
        return true;
    return false;
}

int main()
{
  // freopen("1.txt","r",stdin);
    int k;
    cin >> k;
    vector<int> a;
    for(int i = 0; i<k; i++){
        int x;
        cin >> x;
        a.pb(x);
    }
    sort(all(a));
    vector<int> ans;
    if(a[k-1] == 100){
        ans.pb(100);
        a.pop_back();
    }
    if(a[0]==0)
        ans.push_back(0);
    int inc2=0;
    for(int i =1; i<10; i++)
    if(ispresent(i,a)){
        inc2=1;
        ans.push_back(i);
        break;
    }
    int inc = 0;
    for(int i =10; i<100; i+=10)
    if(ispresent(i,a)){
        ans.push_back(i);
        inc = 1;
        break;
    }
    if(!inc && !inc2 && a[a.size()-1]>10){
        ans.push_back(a[a.size()-1]);
    }
    cout << ans.size();
    nl;
    for(auto x : ans)
        cout << x << " ";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define mod 1000000007
#define si(x) scanf("%d",&x)
#define sc(ch) scanf(" %c",&ch);
#define sl(x) scanf("%I64d",&x)
#define pi(x) printf("%d ",x)
#define nl printf("\n")
#define mp make_pair
#define pb push_back
#define f first
#define se second
#define pii pair<int,int>
#define RESET(a) memset(a,-1,sizeof(a))
#define CLEAR(a) memset(a,0,sizeof(a))
#define all(v)   v.begin(),v.end()
#define trv(it,v) for(it=v.begin();it!=v.end();it++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define MIN INT_MIN
#define MAX INT_MAX
//freopen("op-1.txt","w",stdout);

int main()
{
    //freopen("1.txt","r",stdin);
    int k;
    cin >> k;
    int a[105];
    vector<int> ans;
    int inc = 0;
    for(int i=0; i<k; i++){
        int x;
        cin >> x;
        if(!x){
            ans.pb(x);
            continue;
        }
        bool flag = false;
        int y = x;
        while(y){
            int z = y%10;
            if(z == 0){
                flag = true;
                break;
            }
            y /= 10;
        }
        //cout << x <<" "<<flag;nl;
        if(flag)
            ans.pb(x);
        else{
            if(!inc){
                ans.pb(x);
                inc = 1;
            }
        }
    }
    if(ans.size()==1){
        cout << "0";
        return 0;
    }
    cout << ans.size();
    nl;
    for(auto x : ans)
        cout << x << " ";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define mod 1000000007
#define si(x) scanf("%d",&x)
#define sc(ch) scanf(" %c",&ch);
#define sl(x) scanf("%I64d",&x)
#define pi(x) printf("%d ",x)
#define nl printf("\n")
#define mp make_pair
#define pb push_back
#define f first
#define se second
#define pii pair<int,int>
#define RESET(a) memset(a,-1,sizeof(a))
#define CLEAR(a) memset(a,0,sizeof(a))
#define all(v)   v.begin(),v.end()
#define trv(it,v) for(it=v.begin();it!=v.end();it++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define MIN INT_MIN
#define MAX INT_MAX
//freopen("op-1.txt","w",stdout);

int main()
{
    //freopen("1.txt","r",stdin);
    int k;
    cin >> k;
    int a[105];
    vector<int> ans;
    int inc = 0;
    for(int i=0; i<k; i++){
        int x;
        cin >> x;
        if(!x){
            ans.pb(x);
            continue;
        }
        bool flag = false;
        int y = x;
        while(y){
            int z = y%10;
            if(z == 0){
                flag = true;
                break;
            }
            y /= 10;
        }
        if(flag)
            ans.pb(x);
        else{
            if(!inc){
                ans.pb(x);
                inc = 1;
            }
        }
    }
    if(ans.size()==1){
        cout << "0";
        return 0;
    }
    cout << ans.size();
    nl;
    for(auto x : ans)
        cout << x << " ";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define mod 1000000007
#define si(x) scanf("%d",&x)
#define sc(ch) scanf(" %c",&ch);
#define sl(x) scanf("%I64d",&x)
#define pi(x) printf("%d ",x)
#define nl printf("\n")
#define mp make_pair
#define pb push_back
#define f first
#define se second
#define pii pair<int,int>
#define RESET(a) memset(a,-1,sizeof(a))
#define CLEAR(a) memset(a,0,sizeof(a))
#define all(v)   v.begin(),v.end()
#define trv(it,v) for(it=v.begin();it!=v.end();it++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define MIN INT_MIN
#define MAX INT_MAX
//freopen("op-1.txt","w",stdout);

int main()
{
    //freopen("1.txt","r",stdin);
    int k;
    cin >> k;
    int a[105];
    vector<int> ans;
    int inc = 0;
    for(int i=0; i<k; i++){
        int x;
        cin >> x;
        if(!x){
            ans.pb(x);
            continue;
        }
        bool flag = false;
        int y = x;
        while(y){
            int z = y%10;
            if(z == 0){
                flag = true;
                break;
            }
            y /= 10;
        }
        if(flag)
            ans.pb(x);
        else{
            if(!inc){
                ans.pb(x);
                inc = 1;
            }
        }
    }
    cout << ans.size();
    nl;
    for(auto x : ans)
        cout << x << " ";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define mod 1000000007
#define si(x) scanf("%d",&x)
#define sc(ch) scanf(" %c",&ch);
#define sl(x) scanf("%I64d",&x)
#define pi(x) printf("%d ",x)
#define nl printf("\n")
#define mp make_pair
#define pb push_back
#define f first
#define se second
#define pii pair<int,int>
#define RESET(a) memset(a,-1,sizeof(a))
#define CLEAR(a) memset(a,0,sizeof(a))
#define all(v)   v.begin(),v.end()
#define trv(it,v) for(it=v.begin();it!=v.end();it++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define MIN INT_MIN
#define MAX INT_MAX
//freopen("op-1.txt","w",stdout);

bool ispresent(int x, vector<int> &a)
{
    for(int i=0; i<a.size(); i++)
        if(a[i]==x)
        return true;
    return false;
}

int main()
{
  // freopen("1.txt","r",stdin);
    int k;
    cin >> k;
    vector<int> a;
    for(int i = 0; i<k; i++){
        int x;
        cin >> x;
        a.pb(x);
    }
    sort(all(a));
    vector<int> ans;
    if(a[k-1] == 100){
        ans.pb(100);
        a.pop_back();
    }
    if(a[0]==0)
        ans.push_back(0);
    for(int i =1; i<10; i++)
    if(ispresent(i,a)){
        ans.push_back(i);
        break;
    }
    int inc = 0;
    for(int i =10; i<100; i+=10)
    if(ispresent(i,a)){
        ans.push_back(i);
        inc = 1;
        break;
    }
    if(!inc && a[a.size()-1]>10){
        ans.push_back(a[a.size()-1]);
    }
    if(ans.size()==1){
        cout << "0";
        return 0;
    }
    cout << ans.size();
    nl;
    for(auto x : ans)
        cout << x << " ";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n , t = -1;
    string s[100];
    vector<string>v;
    cin >> n ;

    for(int i=0 ; i<n ; i++)
    {
        cin >> s[i];
        if(s[i].find('0') != -1)
            v.push_back(s[i]);
        else
            t=i;
    }

    if(t != -1)
        v.push_back(s[t]);

    cout << v.size() << endl;
    for(int i=0 ; i<v.size() ; i++)
        cout << v[i] << " ";
}


#include <bits/stdc++.h>
using namespace std;

int main()
{
    vector < int > v ;
    int n  , p  = 0 , check = 0;
    cin >> n  ;
    int a[n] ;
    for (int i = 0 ; i< n ; i++ )
    {
        cin >> a[i] ;
        if (a[i] == 0) v.push_back(0);
        if (a[i] == 100 )v.push_back(100);
        if(a[i] % 10 == 0 && check == 0)
        {
            v.push_back(a[i]) ;
            check = 1;
        }
        if (a[i] >= 1 && a[i]<= 9 || a[i] % 10 != 0 )
        {
            p = a[i] ;
        }

    }
    if (v.size() >= 1)
    {
        v.push_back(p);
    }
    if(v.size() > 1){
    cout << v.size() << "\n";
    for (int i = 0; i< v.size() ; i++ )
        cout << v[i] << " " ;
    }
}


#include <bits/stdc++.h>
using namespace std;

int main()
{
    vector < int > v ;
    int n  , p  = 0 , check = 0 , d = 0 ;
    cin >> n  ;
    int a[n] ;
    bool a1 = false , a2 = false ;
    for (int i = 0 ; i< n ; i++ )
    {
        cin >> a[i] ;
        if (a[i] == 0) v.push_back(0);
        if (a[i] == 100 )v.push_back(100);
        if(a[i] % 10 == 0 && check == 0 && a[i] != 100)
        {
            v.push_back(a[i]) ;
            check = 1;
        }
        if (a[i] >= 1 && a[i]<= 9  )
        {
            p = a[i] ;
        }
        if (a[i] >= 11 && a[i]<= 99 && a[i] % 10 != 0 )
        {
            d = a[i] ;
        }

    }
    if (check == 1 && p > 0) v.push_back(p) ;
    else if(d > 0 ) v.push_back(d) ;
    if(v.size() > 1){
    cout << v.size() << "\n";
    for (int i = 0; i< v.size() ; i++ )
        cout << v[i] << " " ;
    }
}


#include <bits/stdc++.h>
using namespace std;

int main()
{
    vector < int > v ;
    int n  , p  = 0 , check = 0;
    cin >> n  ;
    int a[n] ;
    for (int i = 0 ; i< n ; i++ )
    {
        cin >> a[i] ;
        if (a[i] == 0) v.push_back(0);
        if (a[i] == 100 )v.push_back(100);
        if(a[i] % 10 == 0 && check == 0 && a[i] != 100)
        {
            v.push_back(a[i]) ;
            check = 1;
        }
        if (a[i] >= 1 && a[i]<= 9 || a[i] % 10 != 0 )
        {
            p = a[i] ;
        }

    }
    if (v.size() >= 1)
    {
        v.push_back(p);
    }
    if(v.size() > 1){
    cout << v.size() << "\n";
    for (int i = 0; i< v.size() ; i++ )
        cout << v[i] << " " ;
    }
}


#include <bits/stdc++.h>
using namespace std;

int main()
{
    vector < int > v ;
    int n  , p  = 0 , check = 0 , d = 0 ;
    cin >> n  ;
    int a[n] ;
    bool a2 = false , a1 = false ;
    for (int i = 0 ; i< n ; i++ )
    {
        cin >> a[i] ;
        if (a[i] == 0) {v.push_back(0);a2 = true ; }
        if (a[i] == 100 ){v.push_back(100);a1 = true ; }
        if(a[i] % 10 == 0 && check == 0 && a[i] != 100 && a[i] != 0 )
        {
            v.push_back(a[i]) ;
            check = 1;
        }
        if (a[i] >= 1 && a[i]<= 9  )
        {
            p = a[i] ;
        }
        if (a[i] >= 11 && a[i]<= 99 && a[i] % 10 != 0 )
        {
            d = a[i] ;
        }

    }
    if ( p > 0 && (check == 1 || a2 || a1) ) v.push_back(p) ;
    else if(d > 0 && a1 ) v.push_back(d) ;
    if(v.size() >= 1){
    cout << v.size() << "\n";
    for (int i = 0; i< v.size() ; i++ )
        cout << v[i] << " " ;
    }
    else
    {
       if(p > 0 ) cout << p ;
       else if(d > 0) cout << d ;
    }
}


#include <bits/stdc++.h>
using namespace std;

int main()
{
    vector < int > v ;
    int n  , p  = 0 , check = 0 , d = 0 ;
    cin >> n  ;
    int a[n] ;
    bool a2 = false , a1 = false ;
    for (int i = 0 ; i< n ; i++ )
    {
        cin >> a[i] ;
        if (a[i] == 0) {v.push_back(0);a2 = true ; }
        if (a[i] == 100 ){v.push_back(100);a1 = true ; }
        if(a[i] % 10 == 0 && check == 0 && a[i] != 100 && a[i] != 0 )
        {
            v.push_back(a[i]) ;
            check = 1;
        }
        if (a[i] >= 1 && a[i]<= 9  )
        {
            p = a[i] ;
        }
        if (a[i] >= 11 && a[i]<= 99 && a[i] % 10 != 0 )
        {
            d = a[i] ;
        }

    }
    if ( p > 0 && (check == 1 || a2 || a1) ) v.push_back(p) ;
    else if(d > 0 && a1 ) v.push_back(d) ;
    if(v.size() > 1){
    cout << v.size() << "\n";
    for (int i = 0; i< v.size() ; i++ )
        cout << v[i] << " " ;
    }
    else cout << 0;
}


#include <bits/stdc++.h>
using namespace std;

int main()
{
    vector < int > v ;
    int n  , p  = 0 , check = 0 , d ;
    cin >> n  ;
    int a[n] ;
    bool a1 = false , a2 = false ;
    for (int i = 0 ; i< n ; i++ )
    {
        cin >> a[i] ;
        if (a[i] == 0) v.push_back(0);
        if (a[i] == 100 )v.push_back(100);
        if(a[i] % 10 == 0 && check == 0 && a[i] != 100)
        {
            v.push_back(a[i]) ;
            check = 1;
        }
        if (a[i] >= 1 && a[i]<= 9  )
        {
            p = a[i] ;
        }
        if (a[i] >= 11 && a[i]<= 99 && a[i] % 10 != 0)
        {
            d = a[i] ;
        }

    }
    if (check == 1) v.push_back(p) ;
    else v.push_back(d) ;
    if(v.size() > 1){
    cout << v.size() << "\n";
    for (int i = 0; i< v.size() ; i++ )
        cout << v[i] << " " ;
    }
}


#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <unordered_set>
#include <algorithm>
#include <tuple>
#include <set>
using namespace std;
int main()
{
	int n;
	cin >> n;
	vector <int> a(n);
	for (int i = 0; i < n; i++)
		cin >> a[i];
	set <int> b;
	bool flag = false;
	bool flag1 = false;
	for (int i = 0; i < n; i++) {
		if (a[i] == 100)
			b.insert(100);
		else if (a[i] == 0)
			b.insert(0);
		else if (!flag) {
			if (a[i] % 10 == 0) {
				b.insert(a[i]);
				flag = true;
			}
		}
		if (!flag1)
			if (a[i] < 10 && a[i] != 0) {
				b.insert(a[i]);
				flag1 = true;
			}
	}
	cout << b.size() << endl;
	for (auto i = b.begin(); i != b.end(); i++)
		cout << *i << ' ';
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <unordered_set>
#include <algorithm>
#include <tuple>
#include <set>
using namespace std;
int main()
{
	int n;
	cin >> n;
	vector <int> a(n);
	for (int i = 0; i < n; i++)
		cin >> a[i];
	set <int> b;
	bool flag = false;
	bool flag1 = false;
	for (int i = 0; i < n; i++) {
		if (a[i] == 100)
			b.insert(100);
		else if (a[i] == 0)
			b.insert(0);
		else if (!flag) {
			if (a[i] % 10 == 0) {
				b.insert(a[i]);
				flag = true;
			}
		}
		if (!flag1)
			if (a[i] < 10 && a[i] != 0) {
				b.insert(a[i]);
				flag1 = true;
			}
	}
	if (b.size() == 0 || (b.size() == 1 && b.find(0) != b.end()))
		for (int i = 0; i < n; i++)
			if (a[i] != 0) {
				b.insert(a[i]);
				break;
			}
	cout << b.size() << endl;
	for (auto i = b.begin(); i != b.end(); i++)
		cout << *i << ' ';
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <unordered_set>
#include <algorithm>
#include <tuple>
#include <set>
using namespace std;
int main()
{
	int n;
	cin >> n;
	vector <int> a(n);
	for (int i = 0; i < n; i++)
		cin >> a[i];
	set <int> b;
	bool flag = false;
	bool flag1 = false;
	for (int i = 0; i < n; i++) {
		if (a[i] == 100)
			b.insert(100);
		else if (a[i] == 0)
			b.insert(0);
		else if (!flag) {
			if (a[i] % 10 == 0) {
				b.insert(a[i]);
				flag = true;
			}
		}
		if (!flag1)
			if (a[i] < 10) {
				b.insert(a[i]);
				flag1 = true;
			}
	}
	cout << b.size() << endl;
	for (auto i = b.begin(); i != b.end(); i++)
		cout << *i << ' ';
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <unordered_set>
#include <algorithm>
#include <tuple>
#include <set>
using namespace std;
int main()
{
	int n;
	cin >> n;
	vector <int> a(n);
	for (int i = 0; i < n; i++)
		cin >> a[i];
	set <int> b;
	bool flag = false;
	bool flag1 = false;
	for (int i = 0; i < n; i++) {
		if (a[i] == 100)
			b.insert(100);
		else if (a[i] == 0)
			b.insert(0);
		else if (!flag) {
			if (a[i] % 10 == 0) {
				b.insert(a[i]);
				flag = true;
			}
		}
		if (!flag1)
			if (a[i] < 10 && a[i] != 0) {
				b.insert(a[i]);
				flag1 = true;
			}
	}
	if (b.size() == 0 || (b.size() == 1 && b.find(0) != b.end()) || (b.size() == 1 && b.find(100) != b.end()) || (b.size() == 2 && b.find(0) != b.end() && b.find(100) != b.end()))
		for (int i = 0; i < n; i++)
			if (a[i] != 0 && a[i] != 100) {
				b.insert(a[i]);
				break;
			}
	cout << b.size() << endl;
	for (auto i = b.begin(); i != b.end(); i++)
		cout << *i << ' ';
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <unordered_set>
#include <algorithm>
#include <tuple>
#include <set>
using namespace std;
int main()
{
	int n;
	cin >> n;
	vector <string> a(n);
	for (int i = 0; i < n; i++)
		cin >> a[i];
	vector <string> b;
	for (int i = 0; i < n; i++)
		for (int j = 0; j < a[i].length(); j++)
			if (a[i][j] == '0') {
				b.push_back(a[i]);
				break;
			}
	for (int i = 0; i < n; i++) {
		bool flag = true;
		for (int j = 0; j < a[i].length(); j++)
			if (a[i][j] == '0')
				flag = false;
		if (flag) {
			b.push_back(a[i]);
			break;
		}
	}
	cout << b.size() << endl;
	for (int i = 0; i < b.size(); i++)
		cout << b[i] << ' ';
	return 0;
}


#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<utility>

#include<cstring>
#include<string>
#include<list>
#include<queue>
#include<unordered_map>
#include<unordered_set>
#include<map>
#include<set>
#include<vector>
#include<tuple>
#include<bitset>

using namespace std;

#define sd(a) scanf("%d",&a)
#define sd2(a,b) scanf("%d%d",&a,&b)
#define sd3(a,b,c) scanf("%d%d%d",&a,&b,&c)

#define f(i,n) for(int i=0;i<n;i++)
#define fab(i,a,b) for(int i=a;i<=b;i++)
#define fr(n,i) for(int i=(n-1);i>=0;i--)
#define fabr(i,b,a) for(int i=b;i>=a;i--)

#define debug(a) cout<< a << "\n"
#define debug2(a,b) cout << a << " " << b << "\n"
#define debug3(a,b,c) cout << a << " " << b << " " << c << "\n"

#define  mz(array)  memset(array,0,sizeof(array))

#define mt make_tuple
#define mp make_pair
#define F first
#define S second
#define pb push_back
#define pf pop_front

#define EPS 0.0000001

#define ll long long int

typedef pair<int , int> PI;
typedef vector< int > VI;
typedef vector < vector < int > > VVI;

typedef pair<ll , ll> PL;
typedef vector< int > VL;
typedef vector < vector < ll > > VVL;

typedef tuple<int,int,int> TI;

/*
 * General Purpose Functions
 */

template <typename T>  T max2(T x,T y)
{
    return  (x>y)?x:y;
}
template <typename T> T min2(T x,T y)
{
    return  (x<y)?x:y;
}
template <typename T>  T min3(T x, T y, T z)
{
    return  ((x<y))? ((x<z)?x:z): ((y<z)?y:z);
}
template <typename T> T max3 (T x, T y, T z)
{
    return   ((x>y))? ((x>z)?x:z): ((y>z)?y:z);
}

template <typename T>  T GCD(T u,T v)
{
	if(v==0)
	{
		return u;
	}
	else
	{
		return GCD(v,u%v);
	}
}

template <typename T> T LCM(T u, T v)
{
	return (u*v)/GCD(u,v);
}

/* Weather a number is prime
 */
int IsPrime(int u)
{
	fab(i,2,sqrt(u))
	{
		if(!(u%i))
		{
			return 0;
		}
	}
	return 1;
}

/*power of n
  */
template<typename T> T power(T u,T v)
{
	T ans=1;
	while(v>0)
	{
		if(v%2==1)
			ans=(ans*u);
		v/=2;
		u=(u*u);
	}
	return ans;
}

/* Depth First Search within a Graph
 * Requirements : vector <int> visited
 * 				  vector<int> adj[N]
 */

/*
void DFS(int u)
{
	if(visited[u]==1)
	{
		return;
	}
	else
	{
		visited[u]=1;
		f(i,adj[u].size())
		{
			if(visited[adj[u][i]]==0)
			{
				DFS(adj[u][i]);
			}
		}
	}
}
*/

/* Comparator Function
 */
bool comparator(pair < ll, pair< ll,ll > > const& a, pair < ll, pair< ll,ll > > const& b)
{
	return a.F < b.F;
}

int main()
{
	int n,temp,sf=0,df=0,security;
	cin >> n;

	vector<int> ans;
	f(i,n)
	{
		cin >> temp;
		if(temp==0 || temp==100 )
		{
			ans.pb(temp);
		}
		else if( temp%10==0)
		{
			if(df==0)
			{
				df=1;
				ans.pb(temp);
			}
		}
		else if(temp/10==0)
		{
			if(sf==0)
			{
				sf=1;
				ans.pb(temp);
			}
		}
		else
		{
			security=temp;
		}
	}
	int s=ans.size();
	if(s==0)
	{
		cout << 1 << "\n";
		cout << temp;
		return 0;
	}

	if(sf==0 && df==0)
	{
		ans.pb(security);
	}
	s=ans.size();
	cout << s << "\n";
	f(i,s)
	{
		cout << ans[i] << " ";
	}

	return 0;
}


#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<utility>

#include<cstring>
#include<string>
#include<list>
#include<queue>
#include<unordered_map>
#include<unordered_set>
#include<map>
#include<set>
#include<vector>
#include<tuple>
#include<bitset>

using namespace std;

#define sd(a) scanf("%d",&a)
#define sd2(a,b) scanf("%d%d",&a,&b)
#define sd3(a,b,c) scanf("%d%d%d",&a,&b,&c)

#define f(i,n) for(int i=0;i<n;i++)
#define fab(i,a,b) for(int i=a;i<=b;i++)
#define fr(n,i) for(int i=(n-1);i>=0;i--)
#define fabr(i,b,a) for(int i=b;i>=a;i--)

#define debug(a) cout<< a << "\n"
#define debug2(a,b) cout << a << " " << b << "\n"
#define debug3(a,b,c) cout << a << " " << b << " " << c << "\n"

#define  mz(array)  memset(array,0,sizeof(array))

#define mt make_tuple
#define mp make_pair
#define F first
#define S second
#define pb push_back
#define pf pop_front

#define EPS 0.0000001

#define ll long long int

typedef pair<int , int> PI;
typedef vector< int > VI;
typedef vector < vector < int > > VVI;

typedef pair<ll , ll> PL;
typedef vector< int > VL;
typedef vector < vector < ll > > VVL;

typedef tuple<int,int,int> TI;

/*
 * General Purpose Functions
 */

template <typename T>  T max2(T x,T y)
{
    return  (x>y)?x:y;
}
template <typename T> T min2(T x,T y)
{
    return  (x<y)?x:y;
}
template <typename T>  T min3(T x, T y, T z)
{
    return  ((x<y))? ((x<z)?x:z): ((y<z)?y:z);
}
template <typename T> T max3 (T x, T y, T z)
{
    return   ((x>y))? ((x>z)?x:z): ((y>z)?y:z);
}

template <typename T>  T GCD(T u,T v)
{
	if(v==0)
	{
		return u;
	}
	else
	{
		return GCD(v,u%v);
	}
}

template <typename T> T LCM(T u, T v)
{
	return (u*v)/GCD(u,v);
}

/* Weather a number is prime
 */
int IsPrime(int u)
{
	fab(i,2,sqrt(u))
	{
		if(!(u%i))
		{
			return 0;
		}
	}
	return 1;
}

/*power of n
  */
template<typename T> T power(T u,T v)
{
	T ans=1;
	while(v>0)
	{
		if(v%2==1)
			ans=(ans*u);
		v/=2;
		u=(u*u);
	}
	return ans;
}

/* Depth First Search within a Graph
 * Requirements : vector <int> visited
 * 				  vector<int> adj[N]
 */

/*
void DFS(int u)
{
	if(visited[u]==1)
	{
		return;
	}
	else
	{
		visited[u]=1;
		f(i,adj[u].size())
		{
			if(visited[adj[u][i]]==0)
			{
				DFS(adj[u][i]);
			}
		}
	}
}
*/

/* Comparator Function
 */
bool comparator(pair < ll, pair< ll,ll > > const& a, pair < ll, pair< ll,ll > > const& b)
{
	return a.F < b.F;
}

int main()
{
	int n,temp,sf=0,df=0,security=-1;
	cin >> n;

	vector<int> ans;
	f(i,n)
	{
		cin >> temp;
		if(temp==0 || temp==100 )
		{
			ans.pb(temp);
		}
		else if( temp%10==0)
		{
			if(df==0)
			{
				df=1;
				ans.pb(temp);
			}
		}
		else if(temp/10==0)
		{
			if(sf==0)
			{
				sf=1;
				ans.pb(temp);
			}
		}
		else
		{
			security=temp;
		}
	}
	if(n==1)
	{
		cout << 1 << "\n";
		cout << temp;
		return 0;
	}
	int s=ans.size();
	if(s==0)
	{
		cout << 1 << "\n";
		cout << temp;
		return 0;
	}

	if(sf==0 && df==0 && security!=-1)
	{
		ans.pb(security);
	}
	s=ans.size();
	cout << s << "\n";
	f(i,s)
	{
		cout << ans[i] << " ";
	}

	return 0;
}


#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<utility>

#include<cstring>
#include<string>
#include<list>
#include<queue>
#include<unordered_map>
#include<unordered_set>
#include<map>
#include<set>
#include<vector>
#include<tuple>
#include<bitset>

using namespace std;

#define sd(a) scanf("%d",&a)
#define sd2(a,b) scanf("%d%d",&a,&b)
#define sd3(a,b,c) scanf("%d%d%d",&a,&b,&c)

#define f(i,n) for(int i=0;i<n;i++)
#define fab(i,a,b) for(int i=a;i<=b;i++)
#define fr(n,i) for(int i=(n-1);i>=0;i--)
#define fabr(i,b,a) for(int i=b;i>=a;i--)

#define debug(a) cout<< a << "\n"
#define debug2(a,b) cout << a << " " << b << "\n"
#define debug3(a,b,c) cout << a << " " << b << " " << c << "\n"

#define  mz(array)  memset(array,0,sizeof(array))

#define mt make_tuple
#define mp make_pair
#define F first
#define S second
#define pb push_back
#define pf pop_front

#define EPS 0.0000001

#define ll long long int

typedef pair<int , int> PI;
typedef vector< int > VI;
typedef vector < vector < int > > VVI;

typedef pair<ll , ll> PL;
typedef vector< int > VL;
typedef vector < vector < ll > > VVL;

typedef tuple<int,int,int> TI;

/*
 * General Purpose Functions
 */

template <typename T>  T max2(T x,T y)
{
    return  (x>y)?x:y;
}
template <typename T> T min2(T x,T y)
{
    return  (x<y)?x:y;
}
template <typename T>  T min3(T x, T y, T z)
{
    return  ((x<y))? ((x<z)?x:z): ((y<z)?y:z);
}
template <typename T> T max3 (T x, T y, T z)
{
    return   ((x>y))? ((x>z)?x:z): ((y>z)?y:z);
}

template <typename T>  T GCD(T u,T v)
{
	if(v==0)
	{
		return u;
	}
	else
	{
		return GCD(v,u%v);
	}
}

template <typename T> T LCM(T u, T v)
{
	return (u*v)/GCD(u,v);
}

/* Weather a number is prime
 */
int IsPrime(int u)
{
	fab(i,2,sqrt(u))
	{
		if(!(u%i))
		{
			return 0;
		}
	}
	return 1;
}

/*power of n
  */
template<typename T> T power(T u,T v)
{
	T ans=1;
	while(v>0)
	{
		if(v%2==1)
			ans=(ans*u);
		v/=2;
		u=(u*u);
	}
	return ans;
}

/* Depth First Search within a Graph
 * Requirements : vector <int> visited
 * 				  vector<int> adj[N]
 */

/*
void DFS(int u)
{
	if(visited[u]==1)
	{
		return;
	}
	else
	{
		visited[u]=1;
		f(i,adj[u].size())
		{
			if(visited[adj[u][i]]==0)
			{
				DFS(adj[u][i]);
			}
		}
	}
}
*/

/* Comparator Function
 */
bool comparator(pair < ll, pair< ll,ll > > const& a, pair < ll, pair< ll,ll > > const& b)
{
	return a.F < b.F;
}

int main()
{
	int n,temp,sf=0,df=0;
	cin >> n;

	vector<int> ans;
	f(i,n)
	{
		cin >> temp;
		if(temp==0 || temp==100 )
		{
			ans.pb(temp);
		}
		else if( temp%10==0 && df==0)
		{
			df=1;
			ans.pb(temp);
		}
		else if(temp/10==0 && sf==0)
		{
			sf=1;
			ans.pb(temp);
		}

	}
	int s=ans.size();
	if(s==0)
	{
		cout << 1 << "\n";
		cout << temp;
		return 0;
	}
	cout << s << "\n";
	f(i,s)
	{
		cout << ans[i] << " ";
	}

	return 0;
}


#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<utility>

#include<cstring>
#include<string>
#include<list>
#include<queue>
#include<unordered_map>
#include<unordered_set>
#include<map>
#include<set>
#include<vector>
#include<tuple>
#include<bitset>

using namespace std;

#define sd(a) scanf("%d",&a)
#define sd2(a,b) scanf("%d%d",&a,&b)
#define sd3(a,b,c) scanf("%d%d%d",&a,&b,&c)

#define f(i,n) for(int i=0;i<n;i++)
#define fab(i,a,b) for(int i=a;i<=b;i++)
#define fr(n,i) for(int i=(n-1);i>=0;i--)
#define fabr(i,b,a) for(int i=b;i>=a;i--)

#define debug(a) cout<< a << "\n"
#define debug2(a,b) cout << a << " " << b << "\n"
#define debug3(a,b,c) cout << a << " " << b << " " << c << "\n"

#define  mz(array)  memset(array,0,sizeof(array))

#define mt make_tuple
#define mp make_pair
#define F first
#define S second
#define pb push_back
#define pf pop_front

#define EPS 0.0000001

#define ll long long int

typedef pair<int , int> PI;
typedef vector< int > VI;
typedef vector < vector < int > > VVI;

typedef pair<ll , ll> PL;
typedef vector< int > VL;
typedef vector < vector < ll > > VVL;

typedef tuple<int,int,int> TI;

/*
 * General Purpose Functions
 */

template <typename T>  T max2(T x,T y)
{
    return  (x>y)?x:y;
}
template <typename T> T min2(T x,T y)
{
    return  (x<y)?x:y;
}
template <typename T>  T min3(T x, T y, T z)
{
    return  ((x<y))? ((x<z)?x:z): ((y<z)?y:z);
}
template <typename T> T max3 (T x, T y, T z)
{
    return   ((x>y))? ((x>z)?x:z): ((y>z)?y:z);
}

template <typename T>  T GCD(T u,T v)
{
	if(v==0)
	{
		return u;
	}
	else
	{
		return GCD(v,u%v);
	}
}

template <typename T> T LCM(T u, T v)
{
	return (u*v)/GCD(u,v);
}

/* Weather a number is prime
 */
int IsPrime(int u)
{
	fab(i,2,sqrt(u))
	{
		if(!(u%i))
		{
			return 0;
		}
	}
	return 1;
}

/*power of n
  */
template<typename T> T power(T u,T v)
{
	T ans=1;
	while(v>0)
	{
		if(v%2==1)
			ans=(ans*u);
		v/=2;
		u=(u*u);
	}
	return ans;
}

/* Depth First Search within a Graph
 * Requirements : vector <int> visited
 * 				  vector<int> adj[N]
 */

/*
void DFS(int u)
{
	if(visited[u]==1)
	{
		return;
	}
	else
	{
		visited[u]=1;
		f(i,adj[u].size())
		{
			if(visited[adj[u][i]]==0)
			{
				DFS(adj[u][i]);
			}
		}
	}
}
*/

/* Comparator Function
 */
bool comparator(pair < ll, pair< ll,ll > > const& a, pair < ll, pair< ll,ll > > const& b)
{
	return a.F < b.F;
}

int main()
{
	int n,temp,sf=0,df=0,security;
	cin >> n;

	vector<int> ans;
	f(i,n)
	{
		cin >> temp;
		if(temp==0 || temp==100 )
		{
			ans.pb(temp);
		}
		else if( temp%10==0)
		{
			if(df==0)
			{
				df=1;
				ans.pb(temp);
			}
		}
		else if(temp/10==0)
		{
			if(sf==0)
			{
				sf=1;
				ans.pb(temp);
			}
		}
		else
		{
			security=temp;
		}
	}
	int s=ans.size();
	if(s==0)
	{
		cout << 1 << "\n";
		cout << temp;
		return 0;
	}

	if(sf==0)
	{
		ans.pb(security);
	}
	s=ans.size();
	cout << s << "\n";
	f(i,s)
	{
		cout << ans[i] << " ";
	}

	return 0;
}


#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<utility>

#include<cstring>
#include<string>
#include<list>
#include<queue>
#include<unordered_map>
#include<unordered_set>
#include<map>
#include<set>
#include<vector>
#include<tuple>
#include<bitset>

using namespace std;

#define sd(a) scanf("%d",&a)
#define sd2(a,b) scanf("%d%d",&a,&b)
#define sd3(a,b,c) scanf("%d%d%d",&a,&b,&c)

#define f(i,n) for(int i=0;i<n;i++)
#define fab(i,a,b) for(int i=a;i<=b;i++)
#define fr(n,i) for(int i=(n-1);i>=0;i--)
#define fabr(i,b,a) for(int i=b;i>=a;i--)

#define debug(a) cout<< a << "\n"
#define debug2(a,b) cout << a << " " << b << "\n"
#define debug3(a,b,c) cout << a << " " << b << " " << c << "\n"

#define  mz(array)  memset(array,0,sizeof(array))

#define mt make_tuple
#define mp make_pair
#define F first
#define S second
#define pb push_back
#define pf pop_front

#define EPS 0.0000001

#define ll long long int

typedef pair<int , int> PI;
typedef vector< int > VI;
typedef vector < vector < int > > VVI;

typedef pair<ll , ll> PL;
typedef vector< int > VL;
typedef vector < vector < ll > > VVL;

typedef tuple<int,int,int> TI;

/*
 * General Purpose Functions
 */

template <typename T>  T max2(T x,T y)
{
    return  (x>y)?x:y;
}
template <typename T> T min2(T x,T y)
{
    return  (x<y)?x:y;
}
template <typename T>  T min3(T x, T y, T z)
{
    return  ((x<y))? ((x<z)?x:z): ((y<z)?y:z);
}
template <typename T> T max3 (T x, T y, T z)
{
    return   ((x>y))? ((x>z)?x:z): ((y>z)?y:z);
}

template <typename T>  T GCD(T u,T v)
{
	if(v==0)
	{
		return u;
	}
	else
	{
		return GCD(v,u%v);
	}
}

template <typename T> T LCM(T u, T v)
{
	return (u*v)/GCD(u,v);
}

/* Weather a number is prime
 */
int IsPrime(int u)
{
	fab(i,2,sqrt(u))
	{
		if(!(u%i))
		{
			return 0;
		}
	}
	return 1;
}

/*power of n
  */
template<typename T> T power(T u,T v)
{
	T ans=1;
	while(v>0)
	{
		if(v%2==1)
			ans=(ans*u);
		v/=2;
		u=(u*u);
	}
	return ans;
}

/* Depth First Search within a Graph
 * Requirements : vector <int> visited
 * 				  vector<int> adj[N]
 */

/*
void DFS(int u)
{
	if(visited[u]==1)
	{
		return;
	}
	else
	{
		visited[u]=1;
		f(i,adj[u].size())
		{
			if(visited[adj[u][i]]==0)
			{
				DFS(adj[u][i]);
			}
		}
	}
}
*/

/* Comparator Function
 */
bool comparator(pair < ll, pair< ll,ll > > const& a, pair < ll, pair< ll,ll > > const& b)
{
	return a.F < b.F;
}

int main()
{
	int n,temp,sf=0,df=0,security;
	cin >> n;

	vector<int> ans;
	f(i,n)
	{
		cin >> temp;
		if(temp==0 || temp==100 )
		{
			ans.pb(temp);
		}
		else if( temp%10==0)
		{
			if(df==0)
			{
				df=1;
				ans.pb(temp);
			}
		}
		else if(temp/10==0)
		{
			if(sf==0)
			{
				sf=1;
				ans.pb(temp);
			}
		}
		else
		{
			security=temp;
		}
	}
	int s=ans.size();
	if(s==0 || s==1)
	{
		cout << 1 << "\n";
		cout << temp;
		return 0;
	}

	if(sf==0 && df==0)
	{
		ans.pb(security);
	}
	s=ans.size();
	cout << s << "\n";
	f(i,s)
	{
		cout << ans[i] << " ";
	}

	return 0;
}


#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<utility>

#include<cstring>
#include<string>
#include<list>
#include<queue>
#include<unordered_map>
#include<unordered_set>
#include<map>
#include<set>
#include<vector>
#include<tuple>
#include<bitset>

using namespace std;

#define sd(a) scanf("%d",&a)
#define sd2(a,b) scanf("%d%d",&a,&b)
#define sd3(a,b,c) scanf("%d%d%d",&a,&b,&c)

#define f(i,n) for(int i=0;i<n;i++)
#define fab(i,a,b) for(int i=a;i<=b;i++)
#define fr(n,i) for(int i=(n-1);i>=0;i--)
#define fabr(i,b,a) for(int i=b;i>=a;i--)

#define debug(a) cout<< a << "\n"
#define debug2(a,b) cout << a << " " << b << "\n"
#define debug3(a,b,c) cout << a << " " << b << " " << c << "\n"

#define  mz(array)  memset(array,0,sizeof(array))

#define mt make_tuple
#define mp make_pair
#define F first
#define S second
#define pb push_back
#define pf pop_front

#define EPS 0.0000001

#define ll long long int

typedef pair<int , int> PI;
typedef vector< int > VI;
typedef vector < vector < int > > VVI;

typedef pair<ll , ll> PL;
typedef vector< int > VL;
typedef vector < vector < ll > > VVL;

typedef tuple<int,int,int> TI;

/*
 * General Purpose Functions
 */

template <typename T>  T max2(T x,T y)
{
    return  (x>y)?x:y;
}
template <typename T> T min2(T x,T y)
{
    return  (x<y)?x:y;
}
template <typename T>  T min3(T x, T y, T z)
{
    return  ((x<y))? ((x<z)?x:z): ((y<z)?y:z);
}
template <typename T> T max3 (T x, T y, T z)
{
    return   ((x>y))? ((x>z)?x:z): ((y>z)?y:z);
}

template <typename T>  T GCD(T u,T v)
{
	if(v==0)
	{
		return u;
	}
	else
	{
		return GCD(v,u%v);
	}
}

template <typename T> T LCM(T u, T v)
{
	return (u*v)/GCD(u,v);
}

/* Weather a number is prime
 */
int IsPrime(int u)
{
	fab(i,2,sqrt(u))
	{
		if(!(u%i))
		{
			return 0;
		}
	}
	return 1;
}

/*power of n
  */
template<typename T> T power(T u,T v)
{
	T ans=1;
	while(v>0)
	{
		if(v%2==1)
			ans=(ans*u);
		v/=2;
		u=(u*u);
	}
	return ans;
}

/* Depth First Search within a Graph
 * Requirements : vector <int> visited
 * 				  vector<int> adj[N]
 */

/*
void DFS(int u)
{
	if(visited[u]==1)
	{
		return;
	}
	else
	{
		visited[u]=1;
		f(i,adj[u].size())
		{
			if(visited[adj[u][i]]==0)
			{
				DFS(adj[u][i]);
			}
		}
	}
}
*/

/* Comparator Function
 */
bool comparator(pair < ll, pair< ll,ll > > const& a, pair < ll, pair< ll,ll > > const& b)
{
	return a.F < b.F;
}

int main()
{
	int n,temp,sf=0,df=0,security;
	cin >> n;

	vector<int> ans;
	f(i,n)
	{
		cin >> temp;
		if(temp==0 || temp==100 )
		{
			ans.pb(temp);
		}
		else if( temp%10==0)
		{
			if(df==0)
			{
				df=1;
				ans.pb(temp);
			}
		}
		else if(temp/10==0)
		{
			if(sf==0)
			{
				sf=1;
				ans.pb(temp);
			}
		}
		else
		{
			security=temp;
		}
	}
	if(n==1)
	{
		cout << 1 << "\n";
		cout << temp;
		return 0;
	}
	int s=ans.size();
	if(s==0)
	{
		cout << 1 << "\n";
		cout << temp;
		return 0;
	}

	if(sf==0 && df==0)
	{
		ans.pb(security);
	}
	s=ans.size();
	cout << s << "\n";
	f(i,s)
	{
		cout << ans[i] << " ";
	}

	return 0;
}


#include <iostream>
#include<bits/stdc++.h>

using namespace std;
int a[109];
int k;
vector<int>v;

int main() {
    cin>>k;
bool  f1=0,f=0,f2=0;
    for(int i=0;i<k;i++){
        cin>>a[i];
        if(a[i]==0 || a[i]==100){
            v.push_back(a[i]);
            continue;
            f2=1;
        }
        if(a[i]%10==0 && f==0){
            v.push_back(a[i]);
            f=1;
        }
        else{
            if(f1==0 && a[i]<10){
                f1=1;
                v.push_back(a[i]);
            }
        }
    }
    if(v.size()==0 || (f1==0 && f==0 && f2==1)){
            for(int i=0;i<k;i++)
            if(a[i]%10!= 0 && a[i]>10){
                    v.push_back(a[i]);
                    break;
            }
    }
    cout<<v.size()<<endl;
    for(int i=0;i<v.size();i++)
        cout<<v[i]<<" ";

	return 0;

}


#include <iostream>
#include<bits/stdc++.h>

using namespace std;
int a[109];
int k;
vector<int>v;

int main() {
    cin>>k;
bool  f1=0,f=0,f2=0;
    for(int i=0;i<k;i++){
        cin>>a[i];
        if(a[i]==0 || a[i]==100){
            v.push_back(a[i]);
            f2=1;
            continue;
        }
        if(a[i]%10==0 && f==0){
            v.push_back(a[i]);
            f=1;
        }
        else{
            if(f1==0 && a[i]<10){
                f1=1;
                v.push_back(a[i]);
            }
        }
    }
    if(v.size()==0 || (f1==0 && f==0 && f2==1)){
            for(int i=0;i<k;i++){
            if(a[i]%10!=0 && a[i]>10){
                    v.push_back(a[i]);
                    break;
            }
            }
    }
    cout<<v.size()<<endl;
    for(int i=0;i<v.size();i++)
        cout<<v[i]<<" ";

	return 0;

}


#include <iostream>
#include<bits/stdc++.h>

using namespace std;
int a[109];
int k;
vector<int>v;

int main() {
    cin>>k;
bool  f1=0,f=0,f2=0;
    for(int i=0;i<k;i++){
        cin>>a[i];
        if(a[i]==0 || a[i]==100){
            v.push_back(a[i]);
            continue;
            f2=1;
        }
        if(a[i]%10==0 && f==0){
            v.push_back(a[i]);
            f=1;
        }
        else{
            if(f1==0 && a[i]<10){
                f1=1;
                v.push_back(a[i]);
            }
        }
    }
    if(v.size()==0 || (f1==0 && f==0 && f2==1)){
            for(int i=0;i<k;i++)
                if(a[i]%10!= 0 && a[i]>10)v.push_back(a[i]);
    }
    cout<<v.size()<<endl;
    for(int i=0;i<v.size();i++)
        cout<<v[i]<<" ";

	return 0;

}


#include <iostream>
#include<bits/stdc++.h>

using namespace std;
int a[109];
int k;
vector<int>v;

int main() {
    cin>>k;
bool  f1=0;
    for(int i=0;i<k;i++){
        cin>>a[i];
        if(a[i]==0){
            v.push_back(a[i]);
            continue;
        }
        int x=a[i];
        bool f=0;
        while(x>0){
            int temp=x%10;
            if(temp==0){
                f=1;
                break;
            }
            x/=10;
        }
        if(f){
            v.push_back(a[i]);
        }
        else{
            if(f1==0){
                f1=1;
                v.push_back(a[i]);
            }
        }
    }
    cout<<v.size()<<endl;
    for(int i=0;i<v.size();i++)
        cout<<v[i]<<" ";

	return 0;

}


#include <iostream>
#include<bits/stdc++.h>

using namespace std;
int a[109];
int k;
vector<int>v;

int main() {
    cin>>k;
bool  f1=0,f=0;
    for(int i=0;i<k;i++){
        cin>>a[i];
        if(a[i]==0 || a[i]==100){
            v.push_back(a[i]);
            continue;
        }
        if(a[i]%10==0 && f==0){
            v.push_back(a[i]);
            f=1;
        }
        else{
            if(f1==0 && a[i]<10){
                f1=1;
                v.push_back(a[i]);
            }
        }
    }
    cout<<v.size()<<endl;
    for(int i=0;i<v.size();i++)
        cout<<v[i]<<" ";

	return 0;

}


#include<bits/stdc++.h>
using namespace std;;

int main()
{
    int n, k=-1, z=-1, y=-1;
    cin>>n;
    set<int>s;
    for(int i=0; i<n; ++i)
    {
        int x;
        cin>>x;
        if(x==0 or x==100)  s.insert(x);
        else if(x<10)    y=x;
        else if(x>=10 and x%10==0)   z=x;
        else if(x>10 and x%10!=0) k=x;
    }
    if(y==-1 and z==-1) s.insert(k);
    if(y!=-1)   s.insert(y);
    if(z!=-1)   s.insert(z);
    cout<<s.size()<<endl;
    for(auto c:s)   cout<<c<<' ';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;;

int main()
{
    int n, k=-1, z=-1, y=-1;
    cin>>n;
    set<int>s;
    for(int i=0; i<n; ++i)
    {
        int x;
        cin>>x;
        if(x==0 or x==100)  s.insert(x);
        if(x<10)    y=x;
        if(x>=10 and x%10==0)   z=x;
        if(k>10 and k%10!=0) k=x;
    }
    if(y==-1 and z==-1) s.insert(k);
    if(y!=-1)   s.insert(y);
    if(z!=-1)   s.insert(z);
    for(auto c:s)   cout<<c<<' ';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;;

int main()
{
    int n, k=-1, z=-1, y=-1;
    cin>>n;
    set<int>s;
    for(int i=0; i<n; ++i)
    {
        int x;
        cin>>x;
        if(x==0 or x==100)  s.insert(x);
        else if(x<10)    y=x;
        if(x>=10 and x%10==0)   z=x;
        if(k>10 and k%10!=0) k=x;
    }
    if(y==-1 and z==-1) s.insert(k);
    if(y!=-1)   s.insert(y);
    if(z!=-1)   s.insert(z);
    for(auto c:s)   cout<<c<<' ';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin>>n;
    int a[n], b[n];
    int f=0, k=-1;
    vector<int>g, pu;
    for(int i=0; i<n; ++i)
    {
        cin>>a[i];
        b[i]=a[i];
        if(a[i]==100)   f=1, k=i;
        if(a[i]!=100 and a[i]/10>0 and a[i]%10>0)   g.push_back(i);
    }
    int ans=0;
    if(f==1)
    {
        if(g.size()>=1)
        {
            ans=1;
            pu.push_back(k);
            a[k]=-1;
            k=-1;
            pu.push_back(g[0]);
            for(auto c:g)
            {
                a[c]=-1;
            }
        }
    }
    for(int i=0; i<n; ++i)
    {
        if(a[i]!=-1)
        {
            for(int j=0; j<n; ++j)
            {
                if(i==j)    continue;
                if(a[j]!=-1)
                {
                    pu.push_back(i);
                    pu.push_back(j);
                    a[i]=-1;
                    a[j]=-1;
                    break;
                }
            }
        }
    }
    cout<<pu.size()<<endl;
    for(auto c:pu)  cout<<b[c]<<' ';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;;

int main()
{
    int n, k=-1, z=-1, y=-1;
    cin>>n;
    set<int>s;
    for(int i=0; i<n; ++i)
    {
        int x;
        cin>>x;
        if(x==0 or x==100)  s.insert(x);
        else if(x<10)    y=x;
        else if(x>=10 and x%10==0)   z=x;
        else if(x>10 and x%10!=0) k=x;
    }
    if(y==-1 and z==-1 and k!=-1) s.insert(k);
    if(y!=-1)   s.insert(y);
    if(z!=-1)   s.insert(z);
    cout<<s.size()<<endl;
    for(auto c:s)   cout<<c<<' ';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;;

int main()
{
    int n, k=-1, z=-1, y=-1;
    cin>>n;
    set<int>s;
    for(int i=0; i<n; ++i)
    {
        int x;
        cin>>x;
        if(x==0 or x==100)  s.insert(x);
        else if(x<10)    y=x;
        if(x>=10 and x%10==0 and x!=100)   z=x;
        if(x>10 and x%10!=0) k=x;
    }
    if(y==-1 and z==-1 and k!=-1) s.insert(k);
    if(y!=-1)   s.insert(y);
    if(z!=-1)   s.insert(z);
    cout<<s.size()<<endl;
    for(auto c:s)   cout<<c<<' ';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;;

int main()
{
    int n, k=-1, z=-1, y=-1;
    cin>>n;
    set<int>s;
    for(int i=0; i<n; ++i)
    {
        int x;
        cin>>x;
        if(x==0 or x==100)  s.insert(x);
        else if(x<10)    y=x;
        if(x>=10 and x%10==0)   z=x;
        if(k>10 and k%10!=0) k=x;
    }
    if(y==-1 and z==-1) s.insert(k);
    if(y!=-1)   s.insert(y);
    if(z!=-1)   s.insert(z);
    cout<<s.size()<<endl;
    for(auto c:s)   cout<<c<<' ';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;;

int main()
{
    int n, k=-1, z=-1, y=-1;
    cin>>n;
    set<int>s;
    for(int i=0; i<n; ++i)
    {
        int x;
        cin>>x;
        if(x==0 or x==100)  s.insert(x);
        else if(x<10)    y=x;
        else if(x>=10 and x%10==0)   z=x;
        else if(k>10 and k%10!=0) k=x;
    }
    if(y==-1 and z==-1) s.insert(k);
    if(y!=-1)   s.insert(y);
    if(z!=-1)   s.insert(z);
    cout<<s.size()<<endl;
    for(auto c:s)   cout<<c<<' ';
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define f first
#define s second
#define pb push_back
typedef vector<int> vi;
typedef pair<int, int> pi;
#define mod 1000000007
#define fio ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
int32_t main()
{
    fio;
    int n;
    cin >> n;
    stack<int> s1, s2;
    vi l(n + 1), r(n + 1);
    vi a(n);
    for (int i = 0; i < n; i++)
        cin >> a[i];
    for (int i = 0; i < n; i++)
    {
        while (!s1.empty() && a[s1.top()] >= a[i])
            s1.pop();
        if (s1.empty())
            l[i] = -1;
        else
            l[i] = s1.top();
        s1.push(i);
        while (!s2.empty() && a[s2.top()] >= a[n - 1 - i])
            s2.pop();
        if (s2.empty())
            r[n - 1 - i] = n;
        else
            r[n - 1 - i] = s2.top();
        s2.push(n - 1 - i);
    }
    vector<pi> v;
    for (int i = 0; i < n; i++)
        v.pb({r[i] - l[i] - 1, a[i]});
    sort(v.begin(), v.end());
    vi tans(n + 2, 0);
    for (int i = n - 1; i >= 0; i--)
    {
        tans[v[i].f] = max(tans[v[i].f], v[i].s);
    }
    for (int i = n; i >= 0; i--)
    {
        tans[i] = max(tans[i + 1], tans[i]);
    }
    for (int i = 1; i <= n; i++)
        cout << tans[i] << " ";
    return 0;
}


/*
	Coded with love by :- Ashutosh Singh
	Indian Institute of Information Technology Sricity
*/
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace std;
#define int long long
#define mod 1000000007
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define f(i,n) for(int i=0;i<n;i++)
#define fp(i,k,n) for(int i=k;i<=n;i++)
#define fr(i,k,n) for(int i=k;i>=n;i--)
#define pb push_back
#define F first
#define S second

const int mx=10e6+5;
int a[mx],ans[mx],l[mx],r[mx];
stack<int> s;
void solve()
{
	int n;
	cin >> n;
	fp(i,0,n-1)
	 cin >> a[i];
	f(i,1000000)
	 l[i]=-1,r[i]=n;
	// fill(r,r+mx,n);
	f(i,n)
	{
	while(!s.empty() && a[s.top()] >= a[i])
			s.pop();
		if(!s.empty())
			l[i] = s.top();
		s.push(i);
	}
	while(!s.empty())
		s.pop();
	fr(i,n-1,0){
		while(!s.empty() && a[s.top()] >= a[i])
			s.pop();
		if(!s.empty())
			r[i] = s.top();
		s.push(i);
	}
	f(i,n)
	{
		int len = r[i] - l[i] - 1;
		ans[len]=max(ans[len],a[i]);
	}
	fr(i,n,0)
		ans[i]=max(ans[i],ans[i+1]);
	fp(i,1,n)
		printf("%d ", ans[i]);
	cout << '\n';
	return ;
}

signed main()
{
	// FAST
	int T=1;
	// cin >> T;
	while(T--)
	{
		solve();
	}
	return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define Foreach(i, c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define For(i,a,b) for(int (i)=(a);(i) < (b); ++(i))
#define rof(i,a,b) for(int (i)=(a);(i) > (b); --(i))
#define rep(i, c) for(auto &(i) : (c))
#define x first
#define y second
#define pb push_back
#define PB pop_back()
#define iOS ios_base::sync_with_stdio(false)
#define sqr(a) (((a) * (a)))
#define all(a) a.begin() , a.end()
#define error(x) cerr << #x << " = " << (x) <<endl
#define Error(a,b) cerr<<"( "<<#a<<" , "<<#b<<" ) = ( "<<(a)<<" , "<<(b)<<" )\n";
#define errop(a) cerr<<#a<<" = ( "<<((a).x)<<" , "<<((a).y)<<" )\n";
#define coud(a,b) cout<<fixed << setprecision((b)) << (a)
#define L(x) ((x)<<1)
#define R(x) (((x)<<1)+1)
#define umap unordered_map
#define double long double
typedef long long ll;
typedef pair<int,int>pii;
typedef vector<int> vi;
typedef complex<double> point;
template <typename T> using os =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <class T>  inline void smax(T &x,T y){ x = max((x), (y));}
template <class T>  inline void smin(T &x,T y){ x = min((x), (y));}
const int maxn = 1e6 + 100;
int a[maxn], n, l[maxn], r[maxn], ans[maxn];
stack<int> s;
int main(){
	scanf("%d", &n);
	For(i,0,n)
		scanf("%d", a + i);
	fill(l, l + maxn, -1);
	fill(r, r + maxn, n);
	For(i,0,n){
		while(!s.empty() && a[s.top()] >= a[i])
			s.pop();
		if(!s.empty())
			l[i] = s.top();
		s.push(i);
	}
	while(!s.empty())
		s.pop();
	rof(i,n-1,-1){
		while(!s.empty() && a[s.top()] >= a[i])
			s.pop();
		if(!s.empty())
			r[i] = s.top();
		s.push(i);
	}
	For(i,0,n){
		int len = r[i] - l[i] - 1;
		smax(ans[len], a[i]);
	}
	rof(i,n,-1)
		smax(ans[i], ans[i+1]);
	For(i,1,n+1)
		printf("%d ", ans[i]);
	cout << endl;
	return 0;
}


/*
	Coded with love by :- Ashutosh Singh
	Indian Institute of Information Technology Sricity
*/
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace std;
#define int long long
#define mod 1000000007
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define f(i,n) for(int i=0;i<n;i++)
#define fp(i,k,n) for(int i=k;i<=n;i++)
#define fr(i,k,n) for(int i=k;i>=n;i--)
#define pb push_back
#define F first
#define S second

const int mx=10e6+5;
int a[mx],ans[mx],l[mx],r[mx];
stack<int> s;
void solve()
{
	int n;
	cin >> n;
	fp(i,0,n-1)
	 cin >> a[i];
	fill(l,l+mx,-1);
	fill(r,r+mx,n);
	f(i,n)
	{
	while(!s.empty() && a[s.top()] >= a[i])
			s.pop();
		if(!s.empty())
			l[i] = s.top();
		s.push(i);
	}
	while(!s.empty())
		s.pop();
	fr(i,n-1,0){
		while(!s.empty() && a[s.top()] >= a[i])
			s.pop();
		if(!s.empty())
			r[i] = s.top();
		s.push(i);
	}
	f(i,n)
	{
		int len = r[i] - l[i] - 1;
		ans[len]=max(ans[len],a[i]);
	}
	fr(i,n,0)
		ans[i]=max(ans[i],ans[i+1]);
	fp(i,1,n)
		printf("%d ", ans[i]);
	cout << '\n';
	return ;
}

signed main()
{
	// FAST
	int T=1;
	// cin >> T;
	while(T--)
	{
		solve();
	}
	return 0;
}


/*
	Coded with love by :- Ashutosh Singh
	Indian Institute of Information Technology Sricity
*/
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace std;
// #define int long long
#define mod 1000000007
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define f(i,n) for(int i=0;i<n;i++)
#define fp(i,k,n) for(int i=k;i<=n;i++)
#define fr(i,k,n) for(int i=k;i>=n;i--)
#define pb push_back
#define F first
#define S second

const int mx=10e6+5;
int a[mx],ans[mx],l[mx],r[mx];
stack<int> s;
void solve()
{
	int n;
	cin >> n;
	fp(i,0,n-1)
	 cin >> a[i];
	fill(l,l+mx,-1);
	fill(r,r+mx,n);
	f(i,n)
	{
	while(!s.empty() && a[s.top()] >= a[i])
			s.pop();
		if(!s.empty())
			l[i] = s.top();
		s.push(i);
	}
	while(!s.empty())
		s.pop();
	fr(i,n-1,0){
		while(!s.empty() && a[s.top()] >= a[i])
			s.pop();
		if(!s.empty())
			r[i] = s.top();
		s.push(i);
	}
	f(i,n)
	{
		int len = r[i] - l[i] - 1;
		ans[len]=max(ans[len],a[i]);
	}
	fr(i,n,0)
		ans[i]=max(ans[i],ans[i+1]);
	fp(i,1,n)
		printf("%d ", ans[i]);
	cout << '\n';
	return ;
}

int main()
{
	FAST
	int T=1;
	// cin >> T;
	while(T--)
	{
		solve();
	}
	return 0;
}


/*
	Coded with love by :- Ashutosh Singh
	Indian Institute of Information Technology Sricity
*/
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace std;
// #define int long long
#define mod 1000000007
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define f(i,n) for(int i=0;i<n;i++)
#define fp(i,k,n) for(int i=k;i<=n;i++)
#define fr(i,k,n) for(int i=k;i>=n;i--)
#define pb push_back
#define F first
#define S second

const int mx=10e6+5;
int a[mx],ans[mx],l[mx],r[mx];
stack<int> s;
void solve()
{
	int n;
	cin >> n;
	fp(i,0,n-1)
	 cin >> a[i];
	f(i,1000000)
	 l[i]=-1,r[i]=n;
	// fill(r,r+mx,n);
	f(i,n)
	{
	while(!s.empty() && a[s.top()] >= a[i])
			s.pop();
		if(!s.empty())
			l[i] = s.top();
		s.push(i);
	}
	while(!s.empty())
		s.pop();
	fr(i,n-1,0){
		while(!s.empty() && a[s.top()] >= a[i])
			s.pop();
		if(!s.empty())
			r[i] = s.top();
		s.push(i);
	}
	f(i,n)
	{
		int len = r[i] - l[i] - 1;
		ans[len]=max(ans[len],a[i]);
	}
	fr(i,n,0)
		ans[i]=max(ans[i],ans[i+1]);
	fp(i,1,n)
		printf("%d ", ans[i]);
	cout << '\n';
	return ;
}

int main()
{
	// FAST
	int T=1;
	// cin >> T;
	while(T--)
	{
		solve();
	}
	return 0;
}


/*
	Coded with love by :- Ashutosh Singh
	Indian Institute of Information Technology Sricity
*/
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace std;
// #define int long long
#define mod 1000000007
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define f(i,n) for(int i=0;i<n;i++)
#define fp(i,k,n) for(int i=k;i<=n;i++)
#define fr(i,k,n) for(int i=k;i>=n;i--)
#define pb push_back
#define F first
#define S second

const int mx=10e6+5;
int a[mx],ans[mx],l[mx],r[mx];
stack<int> s;
void solve()
{
	int n;
	cin >> n;
	fp(i,0,n-1)
	 cin >> a[i];
	fill(l,l+mx,-1);
	fill(r,r+mx,n);
	f(i,n)
	{
	while(!s.empty() && a[s.top()] >= a[i])
			s.pop();
		if(!s.empty())
			l[i] = s.top();
		s.push(i);
	}
	while(!s.empty())
		s.pop();
	fr(i,n-1,0){
		while(!s.empty() && a[s.top()] >= a[i])
			s.pop();
		if(!s.empty())
			r[i] = s.top();
		s.push(i);
	}
	f(i,n)
	{
		int len = r[i] - l[i] - 1;
		ans[len]=max(ans[len],a[i]);
	}
	fr(i,n,0)
		ans[i]=max(ans[i],ans[i+1]);
	fp(i,1,n)
		printf("%d ", ans[i]);
	cout << '\n';
	return ;
}

int main()
{
	// FAST
	int T=1;
	// cin >> T;
	while(T--)
	{
		solve();
	}
	return 0;
}


/*
	Coded with love by :- Ashutosh Singh
	Indian Institute of Information Technology Sricity
*/
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace std;
#define int long long
#define mod 1000000007
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define f(i,n) for(int i=0;i<n;i++)
#define fp(i,k,n) for(int i=k;i<=n;i++)
#define fr(i,k,n) for(int i=k;i>=n;i--)
#define pb push_back
#define F first
#define S second

const int mx=10e6+5;
int a[mx],ans[mx],l[mx],r[mx];
stack<int> s;
void solve()
{
	int n;
	cin >> n;
	fp(i,0,n-1)
	 cin >> a[i];
	fill(l,l+mx,-1);
	fill(r,r+mx,n);
	f(i,n)
	{
	while(!s.empty() && a[s.top()] >= a[i])
			s.pop();
		if(!s.empty())
			l[i] = s.top();
		s.push(i);
	}
	while(!s.empty())
		s.pop();
	fr(i,n-1,0){
		while(!s.empty() && a[s.top()] >= a[i])
			s.pop();
		if(!s.empty())
			r[i] = s.top();
		s.push(i);
	}
	f(i,n)
	{
		int len = r[i] - l[i] - 1;
		ans[len]=max(ans[len],a[i]);
	}
	fr(i,n,0)
		ans[i]=max(ans[i],ans[i+1]);
	fp(i,1,n)
		printf("%d ", ans[i]);
	cout << '\n';
	return ;
}

signed main()
{
	FAST
	int T=1;
	// cin >> T;
	while(T--)
	{
		solve();
	}
	return 0;
}


/**    Rose's very long and elaborated template    **/

#include<bits/stdc++.h>
#pragma GCC optimize("O3")
#define mod 1000000007
#define fi first
#define se second
using namespace std;
int n;
int v[200002];
int stiva[200002], sz;
int st[200002];
int dr[200002];
int mx[200002];
int prmx[200002];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    // shuffle(permutation.begin(), permutation.end(), rng);
    cin>>n;
    for(int i = 1; i <= n; ++i)
        cin >> v[i];
    for(int i = 1; i <= n; ++i)
    {
        while(sz && v[i] <= v[stiva[sz]])
            --sz;
        if(!sz)
            st[i] = 0;
        else
            st[i] = stiva[sz];
        stiva[++sz] = i;
    }
    sz = 0;
    for(int i = n; i >= 1; --i)
    {
        while(sz && v[i] <= v[stiva[sz]])
            --sz;
        if(!sz)
            dr[i] = n+1;
        else
            dr[i] = stiva[sz];
        stiva[++sz] = i;
    }
    for(int i = 1; i <= n; ++i)
    {
        int sz = dr[i] - st[i] - 1;
        if(v[i] >= mx[sz])
            mx[sz] = v[i];
    }
    for(int i = n; i >= 1; --i)
        prmx[i] = max(prmx[i+1], mx[i]);
    for(int i = 1; i <= n; ++i)
        cout << prmx[i] << " ";
    return 0;
}


/**    Rose's very long and elaborated template    **/

#include<bits/stdc++.h>
#pragma GCC optimize("O3")
#define mod 1000000007
#define fi first
#define se second
using namespace std;
int n;
int v[200002];
deque<int>d;
int st[200002];
int dr[200002];
int mx[200002];
int prmx[200002];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    // shuffle(permutation.begin(), permutation.end(), rng);
    cin>>n;
    for(int i = 1; i <= n; ++i)
        cin >> v[i];
    for(int i = 1; i <= n; ++i)
    {
        while(!d.empty() && v[i] <= v[d.back()])
            d.pop_back();
        if(!d.size())
            st[i] = 0;
        else
            st[i] = d.back();
        d.push_back(i);
    }
    d.clear();
    for(int i = n; i >= 1; --i)
    {
        while(!d.empty() && v[i] <= v[d.back()])
            d.pop_back();
        if(!d.size())
            dr[i] = n+1;
        else
            dr[i] = d.back();
        d.push_back(i);
    }
    for(int i = 1; i <= n; ++i)
    {
        int sz = dr[i] - st[i] - 1;
        if(v[i] >= mx[sz])
            mx[sz] = v[i];
    }
    for(int i = n; i >= 1; --i)
        prmx[i] = max(prmx[i+1], mx[i]);
    for(int i = 1; i <= n; ++i)
        cout << prmx[i] << " ";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n;
int st[1000010];
int v[200010];

void update(int pos,int value){
    for (st[pos+=n]= value; pos > 1; pos>>=1)
        st[pos>>1] = min(st[pos], st[pos^1]);
}

// interval[l,r)
int query(int l,int r){
    int ans = INT_MAX;
    r++;
    for (l+=n,r+=n;l<r;l>>=1,r>>=1){
        if(l&1) ans = min(ans, st[l++]);
        if(r&1) ans = min(ans, st[--r]);
    }
    return ans;
}

int main() {

    for (int i = 0; i < 1000010; ++i)
        st[i] = INT_MAX;

    scanf("%d", &n);

    int mn = 1e9;
    for (int i = 0; i < n; ++i) {
        scanf("%d", v + i);
        update(i, v[i]);
        mn = min(mn,v[i]);
    }

    priority_queue<pair<int,int> > q;

    //q.push({n, mn});
    for (int i = 0; i < n; ++i) {
        int a = i, b = n;
        while(b - a > 1) {
            int mid = (a + b) / 2;
            if(query(i, mid) == v[i]) a = mid;
            else b = mid;
        }
        int r = a;
        a = 0, b = i;
        while(b - a > 1) {
            int mid = (a + b) / 2;
            if(query(mid, i) == v[i]) b = mid;
            else a = mid;
        }
        int l = b;
        q.push({(r - l + 1), v[i]});
    }

    vector<int> a;
    int ans = 0;
    for (int i = n; i >= 1; i--) {
        while(!q.empty() and q.top().first >= i) {
            ans = max(ans, q.top().second);
            q.pop();
        }
        a.push_back(ans);
    }

    reverse(a.begin(), a.end());
    for (int x: a)
        printf("%d ", x);
    puts("");
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n;
int v[200010];

int main() {

    scanf("%d", &n);

    priority_queue<tuple<int,int,int> > q;

    for (int i = 0; i < n; ++i)  {
        scanf("%d", v + i);
        q.push({v[i], i, i});
    }

    auto check = [&] (int x) -> bool {
        int vk,l,r;
        tie(vk, l, r) = q.top();
        if(r - l + 1 == x) return 1;
        q.pop();
        int a = INT_MAX;
        int b = INT_MAX;
        if(l) a = min(vk, v[l - 1]);
        if(r + 1 < n) b = min(vk, v[r + 1]);
        if(a != INT_MAX) q.push({a, l - 1, r});
        if(b != INT_MAX) q.push({b, l, r + 1});
        return 0;
    };

    for (int i = 1; i <= n; ++i) {
        while(!check(i)) {}
        printf("%d ", get<0> (q.top()));
    }
    puts("");
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n;
int st[1000010];
int v[200010];

void update(int pos,int value){
    for (st[pos+=n]= value; pos > 1; pos>>=1)
        st[pos>>1] = min(st[pos], st[pos^1]);
}

// interval[l,r)
int query(int l,int r){
    int ans = INT_MAX;
    r++;
    for (l+=n,r+=n;l<r;l>>=1,r>>=1){
        if(l&1) ans = min(ans, st[l++]);
        if(r&1) ans = min(ans, st[--r]);
    }
    return ans;
}

int main() {

    for (int i = 0; i < 1000010; ++i)
        st[i] = INT_MAX;

    scanf("%d", &n);

    int mn = 1e9;
    for (int i = 0; i < n; ++i) {
        scanf("%d", v + i);
        update(i, v[i]);
        mn = min(mn,v[i]);
    }

    priority_queue<pair<int,int> > q;

    for (int i = 0; i < n; ++i) {
        int a = i, b = n;
        while(b - a > 1) {
            int mid = (a + b) / 2;
            if(query(i, mid) == v[i]) a = mid;
            else b = mid;
        }
        int r = a;
        a = -1, b = i;
        while(b - a > 1) {
            int mid = (a + b) / 2;
            if(query(mid, i) == v[i]) b = mid;
            else a = mid;
        }
        int l = b;
        q.push({(r - l + 1), v[i]});
    }

    vector<int> a;
    int ans = 0;
    for (int i = n; i >= 1; i--) {
        while(!q.empty() and q.top().first >= i) {
            ans = max(ans, q.top().second);
            q.pop();
        }
        a.push_back(ans);
    }

    reverse(a.begin(), a.end());
    for (int x: a)
        printf("%d ", x);
    puts("");
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n;
int st[1000010];
int v[200010];

void update(int pos,int value){
    for (st[pos+=n]= value; pos > 1; pos>>=1)
        st[pos>>1] = min(st[pos], st[pos^1]);
}

// interval[l,r)
int query(int l,int r){
    int ans = 1e9;
    r++;
    for (l+=n,r+=n;l<r;l>>=1,r>>=1){
        if(l&1) ans = min(ans, st[l++]);
        if(r&1) ans = min(ans, st[--r]);
    }
    return ans;
}

int main() {

    for (int i = 0; i < 1000010; ++i)
        st[i] = 1e9;

    scanf("%d", &n);

    priority_queue<pair<int,int> > q;
    for (int i = 0; i < n; ++i) {
        scanf("%d", v + i);
        update(i, v[i]);
        q.push({v[i], i});
    }

    auto check = [&] (int k, int x) {
        return query(k - x + 1, k) == v[k];
    };
    for (int i = 1; i <= n; ++i) {
        while(!check(q.top().second, i)) q.pop();
        printf("%d ", q.top().first);
    }
    puts("");
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n;
int st[1000010];
int v[200010];

void update(int pos,int value){
    for (st[pos+=n]= value; pos > 1; pos>>=1)
        st[pos>>1] = min(st[pos], st[pos^1]);
}

// interval[l,r)
int query(int l,int r){
    int ans = INT_MAX;
    r++;
    for (l+=n,r+=n;l<r;l>>=1,r>>=1){
        if(l&1) ans = min(ans, st[l++]);
        if(r&1) ans = min(ans, st[--r]);
    }
    return ans;
}

int main() {

    for (int i = 0; i < 1000010; ++i)
        st[i] = INT_MAX;

    scanf("%d", &n);

    priority_queue<pair<int,int> > q;
    for (int i = 0; i < n; ++i) {
        scanf("%d", v + i);
        update(i, v[i]);
        q.push({v[i], i});
    }
    auto check = [&] (int k, int x) {
        //cout << v[k] << " " << x << "\n";
        int a = -1, b = -1;
        if(k - x + 1 >= 0) a = query(k - x + 1, k);
        if(k + x - 1 < n) b = query(k, k + x - 1);
        //cout << a << " " << b << " " << x + k - 1<< " test\n";
        return a == v[k] or b == v[k];
    };
    for (int i = 1; i <= n; ++i) {
        while(!check(q.top().second, i)) q.pop();
        printf("%d ", q.top().first);
    }
    puts("");
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n;
int st[1000010];
int v[200010];

void update(int pos,int value){
    for (st[pos+=n]= value; pos > 1; pos>>=1)
        st[pos>>1] = min(st[pos], st[pos^1]);
}

// interval[l,r)
int query(int l,int r){
    int ans = INT_MAX;
    r++;
    for (l+=n,r+=n;l<r;l>>=1,r>>=1){
        if(l&1) ans = min(ans, st[l++]);
        if(r&1) ans = min(ans, st[--r]);
    }
    return ans;
}

int main() {

    for (int i = 0; i < 1000010; ++i)
        st[i] = INT_MAX;

    scanf("%d", &n);

    int mn = 1e9;
    for (int i = 0; i < n; ++i) {
        scanf("%d", v + i);
        update(i, v[i]);
        mn = min(mn,v[i]);
    }

    priority_queue<pair<int,int> > q;

    q.push({n, mn});
    for (int i = 0; i < n; ++i) {
        int a = i, b = n;
        while(b - a > 1) {
            int mid = (a + b) / 2;
            if(query(i, mid) == v[i]) a = mid;
            else b = mid;
        }
        int r = a;
        a = 0, b = i;
        while(b - a > 1) {
            int mid = (a + b) / 2;
            if(query(mid, i) == v[i]) b = mid;
            else a = mid;
        }
        int l = b;
        q.push({(r - l + 1), v[i]});
    }

    vector<int> a;
    int ans = 0;
    for (int i = n; i >= 1; i--) {
        while(!q.empty() and q.top().first >= i) {
            ans = max(ans, q.top().second);
            q.pop();
        }
        a.push_back(ans);
    }

    reverse(a.begin(), a.end());
    for (int x: a)
        printf("%d ", x);
    puts("");
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n;
int st[1000010];
int v[200010];

void update(int pos,int value){
    for (st[pos+=n]= value; pos > 1; pos>>=1)
        st[pos>>1] = min(st[pos], st[pos^1]);
}

// interval[l,r)
int query(int l,int r){
    int ans = INT_MAX;
    r++;
    for (l+=n,r+=n;l<r;l>>=1,r>>=1){
        if(l&1) ans = min(ans, st[l++]);
        if(r&1) ans = min(ans, st[--r]);
    }
    return ans;
}

int main() {

    for (int i = 0; i < 1000010; ++i)
        st[i] = INT_MAX;

    scanf("%d", &n);

    int mn = 1e9;
    for (int i = 0; i < n; ++i) {
        scanf("%d", v + i);
        update(i, v[i]);
        mn = min(mn,v[i]);
    }

    priority_queue<pair<int,int> > q;

    q.push({n, mn});
    for (int i = 1; i <= n; ++i) {
        int a = i, b = n;
        while(b - a > 1) {
            int mid = (a + b) / 2;
            if(query(i, mid) == v[i]) a = mid;
            else b = mid;
        }
        int r = a;
        a = 0, b = i;
        while(b - a > 1) {
            int mid = (a + b) / 2;
            if(query(mid, i) == v[i]) b = mid;
            else a = mid;
        }
        int l = b;
        q.push({(r - l + 1), v[i]});
    }

    vector<int> a;
    int ans = 0;
    for (int i = n; i >= 1; i--) {
        while(!q.empty() and q.top().first >= i) {
            //cout << q.top().first << " " << i << "\n";
            ans = max(ans, q.top().second);
            q.pop();
        }
        //exit(0);
        a.push_back(ans);
    }

    reverse(a.begin(), a.end());
    for (int x: a)
        printf("%d ", x);
    puts("");
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n;
int st[1000010];
int v[200010];

void update(int pos,int value){
    for (st[pos+=n]= value; pos > 1; pos>>=1)
        st[pos>>1] = min(st[pos], st[pos^1]);
}

// interval[l,r)
int query(int l,int r){
    int ans = INT_MAX;
    r++;
    for (l+=n,r+=n;l<r;l>>=1,r>>=1){
        if(l&1) ans = min(ans, st[l++]);
        if(r&1) ans = min(ans, st[--r]);
    }
    return ans;
}

int main() {

    for (int i = 0; i < 1000010; ++i)
        st[i] = INT_MAX;

    scanf("%d", &n);

    priority_queue<pair<int,int> > q;

    for (int i = 0; i < n; ++i) {
        scanf("%d", v + i);
        update(i, v[i]);
        q.push({v[i], i});
    }
    auto check = [&] (int k, int x) {
        int a = -1, b = -1;
        if(k - x + 1 >= 0) a = query(k - x + 1, k);
        if(k + x - 1 < n) b = query(k, k + x - 1);
        return a == v[k] or b == v[k];
    };

    for (int i = 1; i <= n; ++i) {
        while(!q.empty() and !check(q.top().second, i)) q.pop();
        printf("%d ", q.top().first);
    }
    puts("");
    return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define fu(i,a,b) for(ll i=a;i<=b;i++)
#define fd(i,a,b) for(ll i=a;i>=b;i--)
using namespace std;
const ll N = (ll)2e5+5;
ll a[N] , n , l[N] , r[N] , kq[N];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    fu(i,1,n)
    {
        cin >> a[i];
    }
    deque<ll> q;
    q.push_back(0);
    fu(i,1,n)
    {
        while((int)q.size() != 1 && a[q.back()] >= a[i])
            q.pop_back();
        l[i] = q.back()+1;
        q.push_back(i);
    }
    q.clear();
    q.push_back(n+1);
    fd(i,n,1)
    {
        while((int)q.size() != 1 && a[q.back()] >= a[i])
            q.pop_back();
        r[i] = q.back()-1;
        q.push_back(i);
    }
    fu(i,1,n)
    {
        ll res = r[i] - l[i] + 1;
        //cout<<l[i]<<" "<<r[i]<<"\n";
        kq[res] = max(kq[res] , a[i]);
    }
    fd(i,n,1)
    {
        kq[i] = max(kq[i] , kq[i+1]);
    }
    fu(i,1,n)
        cout<<kq[i]<<" ";
}


#include <bits/stdc++.h>
using namespace std;

struct node {
	int x,id;
};

const int M=200005;

int n;
int mx[M];
int A[M],num[M];

void input() {
	cin>>n;
	for (int i=1;i<=n;++i) scanf("%d",&num[i]),A[i]=num[i];
	sort(num+1,num+1+n);
	int sz=unique(num+1,num+1+n)-num-1;
	for (int i=1;i<=n;++i) A[i]=lower_bound(num+1,num+1+sz,A[i])-num;
}

node stk[M];
int L[M],R[M];
void calc(int st,int ed,int k,int *LR) {
	int p=0;
	for (int i=st;i!=ed;i+=k) {
		while (p&&A[i]<stk[p-1].x) LR[stk[p-1].id]=i-k,p--;
		stk[p++]=(node){A[i],i};
	}
	while (p) LR[stk[p-1].id]=ed-k,p--;
}

int main() {
	input();
	calc(1,n+1,1,R);
	calc(n,0,-1,L);
	for (int i=1;i<=n;++i) {
		int len=R[i]-L[i]+1;
		mx[len]=max(mx[len],A[i]);
	}
	for (int i=n;i>=1;--i) mx[i]=max(mx[i],mx[i+1]);
	for (int i=1;i<=n;++i) cout<<mx[i]<<" ";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

struct node {
	int x,id;
};

const int M=200005;

int n;
int mx[M];
int A[M],num[M];

void input() {
	cin>>n;
	for (int i=1;i<=n;++i) scanf("%d",&num[i]),A[i]=num[i];
	sort(num+1,num+1+n);
	int sz=unique(num+1,num+1+n)-num-1;
	for (int i=1;i<=n;++i) A[i]=lower_bound(num+1,num+1+sz,A[i])-num;
}

node stk[M];
int L[M],R[M];
void calc(int st,int ed,int k,int *LR) {
	int p=0;
	for (int i=st;i!=ed;i+=k) {
		while (p&&A[i]<stk[p-1].x) LR[stk[p-1].id]=i-k,p--;
		stk[p++]=(node){A[i],i};
	}
	while (p) LR[stk[p-1].id]=ed-k,p--;
}

int main() {
	input();
	calc(1,n+1,1,R);
	calc(n,0,-1,L);
	for (int i=1;i<=n;++i) {
		int len=R[i]-L[i]+1;
		mx[len]=max(mx[len],A[i]);
	}
	for (int i=n;i>=1;--i) mx[i]=max(mx[i],mx[i+1]);
	for (int i=1;i<=n;++i) cout<<num[mx[i]]<<" ";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define lop ios; ll t; cin>>t; while(t--)
#define pb push_back
#define vi vector<ll>
#define vivi vector<vector<ll>>
#define vipa vector<pair<ll,ll>>
#define F first
#define S second
#define M 1000000007
#define kl "\n"
typedef long long ll;
typedef long double ld;
ll lcm(ll x, ll y){ll k=x*y; k/=(__gcd(x,y)); return k;}
ll power(ll x,ll y){ ll r= 1;x = x % M;if(x==0) return 0; while(y>0) {if(y&1) r=(r*x)%M; y=y>>1; x=(x*x)%M;} return r;}
ll size[200005],par[200005];
ll sum=0;
ll parnt(ll v){
    if(par[v]==v) return v;
    return par[v]=parnt(par[v]);
}
void merge(ll u,ll v){
    ll x=parnt(u);
    ll y=parnt(v);
    if(x==y) return;
    if(size[x]<size[y]) swap(x,y);
    size[x]+=size[y];
    par[y]=x;
}
void solve()
{
ll n,m;
cin>>n;
vipa v;
for(ll i=1;i<=n;i++){
    ll x; cin>>x;
    v.pb({x,i});
}
for(ll i=1;i<=n;i++) size[i]=1,par[i]=i;
sort(v.rbegin(),v.rend());
ll vis[n+1]={0};
ll ans[n+1];
ll k=1;
for(ll i=0;i<n;i++){
    ll pos=v[i].S;
    ll val=v[i].F;
    vis[pos]=1;
    if(vis[pos-1]) merge(pos,pos-1);
    if(pos<n and vis[pos+1]) merge(pos,pos+1);
    ll totalsize=size[parnt(pos)];
    while(k<=totalsize) ans[k++]=val;
}
for(ll i=1;i<=n;i++) cout<<ans[i]<<" ";
}
int main()
{
    // lop
    solve();
	return 0;
}


#include <bits/stdc++.h>
typedef long long ll;

using namespace std;
ll maxx=1e5+2;
struct node
{
    ll value;
    ll msize;
};
int main()
{
    struct node arr[maxx];

    ll n,left,right;
    cin >> n;
    for(ll i = 1; i <= n; i++){
        cin >> arr[i].value;
        arr[i].msize=1;
    }
    for(ll i = 1; i <= n; i++){
        bool flagl=true,flagr=true;
        for(ll j = 1; j < n; j++){
            if(flagl && i - j > 0){
                if(arr[i-j].value >= arr[i].value){
                    arr[i].msize++;
                }
                else{
                    flagl=false;
                }
            }
            if(flagr && i + j <= n){
                    if(arr[i+j].value >= arr[i].value){
                        arr[i].msize++;
                    }
                    else{
                        flagr=false;
                    }
                }
        }
    }
    ll maxx=0;
    for(ll i = 1; i <= n; i++){
            maxx=0;
        for(ll j = 1; j <= n; j++){
            if(arr[j].msize >= i){
                if(arr[j].value > maxx){
                    maxx=arr[j].value;
                }
            }
        }
        printf("%lld ",maxx);
    }
    /**printf("\n");
    for(ll i = 1; i <= n; i++)
        printf("%lld ",arr[i].value);
    printf("\n");
    for(ll i = 1; i <= n; i++)
        printf("%lld ",arr[i].msize);*/
    return 0;
}