#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long rncnt = n;
  vector<long long> rnvec(n, 0);
  while (rncnt--) cin >> rnvec[n - rncnt - 1];
  set<long long> rnset;
  stack<long long> rnstk;
  for (auto rnrb = rnvec.rbegin(), rnre = rnvec.rend(); rnrb != rnre; ++rnrb)
    if (rnset.find(*rnrb) == rnset.end()) {
      rnset.insert(*rnrb);
      rnstk.push(*rnrb);
    }
  cout << rnstk.size() << endl;
  while (!rnstk.empty()) {
    cout << rnstk.top() << " ";
    rnstk.pop();
  }
}
