#include <bits/stdc++.h>
using namespace std;
int main() {
  int ar[1001] = {0};
  int t, n, k;
  cin >> n;
  vector<int> v(n), x;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    ar[v[i]]++;
  }
  int tf[1001] = {0};
  for (int i = 1; i < 1001; i++) {
    if (ar[i]) {
      while (ar[i] > 1) ar[i]--;
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    if (ar[v[i]] && tf[v[i]] == 0) {
      x.push_back(v[i]);
      tf[v[i]] = 1;
    }
  }
  cout << x.size() << endl;
  for (int i = x.size() - 1; i >= 0; i--) {
    cout << x[i] << " ";
  }
}
