#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int cnt[1001] = {0}, a[n];
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    cnt[a[i]] = i;
  }
  int vis[1001] = {0};
  vector<int> res;
  for (int i = 0; i < n; i++) {
    if (cnt[a[i]] == i) res.push_back(a[i]);
  }
  cout << res.size() << endl;
  for (int i = 0; i < res.size(); ++i) cout << res[i] << " ";
  cout << endl;
  return 0;
}
