#include <bits/stdc++.h>   using namespace std;   int n, x;   vector<int> w;   vector<int> v;   bool volt[1111];   int main() {     ios_base::sync_with_stdio(false);     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> x;       v.push_back(x);     }     reverse(v.begin(), v.end());     for (int i = 0; i < v.size(); i++) {       if (volt[v[i]] == false) {         w.push_back(v[i]);         volt[v[i]] = true;       }     }     reverse(w.begin(), w.end());     cout << w.size() << endl;     for (int i = 0; i < w.size(); i++) {       cout << w[i] <<    ;     }   }   