#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, c = 0;
  cin >> n;
  int a[n], b[n];
  map<int, int> mp;
  for (int i = 1; i <= 1001; i++) {
    mp[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = n - 1; i >= 0; i--) {
    if (mp[a[i]] == 0) {
      mp[a[i]] = 1;
      b[c] = a[i];
      c++;
    }
  }
  reverse(b, b + c);
  cout << c << endl;
  for (int i = 0; i < c; i++) cout << b[i] << " ";
  cout << endl;
  return 0;
}
