#include <bits/stdc++.h>
using namespace std;
stack<int> s;
bool e[1000];
int i, n, amountofnums;
string nums;
int main() {
  cin >> i;
  for (; i > 0; i--) {
    cin >> n;
    s.push(n);
  }
  while (s.size()) {
    if (!e[s.top() - 1]) {
      nums = to_string(s.top()) + " " + nums;
      e[s.top() - 1] = true;
      amountofnums++;
    }
    s.pop();
  }
  cout << amountofnums << endl << nums;
}
