#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long arr[n];
  vector<long long> v;
  for (long long i = 0; i < n; i++) cin >> arr[i];
  long long hash[10001] = {0};
  for (long long i = n - 1; i >= 0; i--) {
    if (hash[arr[i]] == 0) {
      v.push_back(arr[i]);
      hash[arr[i]]++;
    }
  }
  reverse(v.begin(), v.end());
  cout << v.size() << endl;
  for (long long i = 0; i < v.size(); i++) cout << v[i] << " ";
}
