/***
** 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;
}
LyoqKgoqKiAgICAgIEJpc21pbGxhaGlyIFJhaG1hbmlyIFJhaGltICAgICAgICAgICAgICAgIAoqKiAgICAgICAgICAgICAgQUxMQUhVIEFLQkFSCioqCioqICAgICBBdXRob3I6IEtoYWlydWwgQW5hbSBNdWJpbiAoX19Ccm9seV9fKQoqKiAgICAgQmFuZ2xhZGVzaCBVbml2ZXJzaXR5IG9mIEJ1c2luZXNzIGFuZCBUZWNobm9sb2d5LAoqKiAgICAgRGVwdC4gb2YgQ1NFLgoqKiovCiNpbmNsdWRlIDxiaXRzL3N0ZGMrKy5oPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwogIAppbnQgbWFpbigpIHsKICAgIGlvc19iYXNlOjpzeW5jX3dpdGhfc3RkaW8oMCk7CiAgICBjaW4udGllKDApOwogICAgY291dC50aWUoMCk7CiAgICAKICAgIGludCBuOyBjaW4gPj4gbjsKICAgIGludCBhcltuICsgMV07CiAgICBtYXAgPGludCAsIGludD4gbXA7CiAgICBmb3IgKGludCBpID0gMDsgaSA8IG47IGkrKykgewogICAgICAgIGNpbiA+PiBhcltpXTsKICAgICAgICBtcFthcltpXV0rKzsKICAgIH0KICAgIHZlY3RvciA8aW50PiBhbnM7CiAgICB3aGlsZSAobXAuc2l6ZSgpICE9IDApIHsKICAgICAgICBhdXRvIGl0ID0gbXAuZW5kKCk7CiAgICAgICAgaXQtLTsKICAgICAgICBpbnQgdmFsID0gaXQtPmZpcnN0OwogICAgICAgIGFucy5wdXNoX2JhY2sodmFsKTsKICAgICAgICBmb3IgKGludCBpID0gMTsgaSAqIGkgPD0gdmFsOyBpKyspIHsKICAgICAgICAgICAgaWYgKHZhbCAlIGkgPT0gMCkgewogICAgICAgICAgICAgICAgaW50IHggPSBpOwogICAgICAgICAgICAgICAgaW50IHkgPSB2YWwgLyBpOwogICAgICAgICAgICAgICAgbXBbeF0tLTsKICAgICAgICAgICAgICAgIGlmIChtcFt4XSA9PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgbXAuZXJhc2UobXAuZmluZCh4KSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoeCAhPSB5KSB7CiAgICAgICAgICAgICAgICAgICAgbXBbeV0tLTsKICAgICAgICAgICAgICAgICAgICBpZiAobXBbeV0gPT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICBtcC5lcmFzZShtcC5maW5kKHkpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9CiAgICBjb3V0IDw8IGFucy5zaXplKCkgPDwgIlxuIjsKICAgIGZvciAoaW50IHggOiBhbnMpIGNvdXQgPDwgeCA8PCAiICI7CiAgICByZXR1cm4gMDsKfQ==