/***
**      Bismillahir Rahmanir Rahim                
**              ALLAHU AKBAR
**
**     Author: Khairul Anam Mubin (__Broly__)
**     Bangladesh University of Business and Technology,
**     Dept. of CSE.
***/
#include <bits/stdc++.h>
using namespace std;
  
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    int n; cin >> n;
    int ar[n + 1];
    map <int , int> mp;
    for (int i = 0; i < n; i++) {
        cin >> ar[i];
        mp[ar[i]]++;
    }
    vector <int> ans;
    while (mp.size() != 0) {
        auto it = mp.end();
        it--;
        int val = it->first;
        ans.push_back(val);
        for (int i = 1; i * i <= val; i++) {
            if (val % i == 0) {
                int x = i;
                int y = val / i;
                mp[x]--;
                if (mp[x] == 0) {
                    mp.erase(mp.find(x));
                }
                if (x != y) {
                    mp[y]--;
                    if (mp[y] == 0) {
                        mp.erase(mp.find(y));
                    }
                }
            }
        }
    }
    cout << ans.size() << "\n";
    for (int x : ans) cout << x << " ";
    return 0;
}