#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  set<int> s;
  vector<int> v;
  cin >> n;
  int a[n + 5];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = n - 1; i >= 0; i--) {
    if (!s.count(a[i])) {
      v.push_back(a[i]);
      s.insert(a[i]);
    }
  }
  cout << v.size() << "\n";
  for (int i = v.size() - 1; i >= 0; i--) {
    cout << v[i] << " ";
  }
}
