#include <iostream>
#include <vector>
using namespace std;

vector<double> array_union(const vector<double>& v1, const vector<double>& v2);

int main() {
    int n1;
    cin >> n1;
    vector<double> v1(n1);
    for (int i = 0; i < n1; ++i) cin >> v1[i];
    int n2;
    cin >> n2;
    vector<double> v2(n2);
    for (int i = 0; i < n2; ++i) cin >> v2[i];
    vector<double> v = array_union(v1, v2);
    cout << v.size() << endl;
    if (v.size() > 0) cout << v[0];
    for (int i = 1; i < v.size(); ++i) cout << " " << v[i];
    if (v.size() > 0) cout << endl;
}
