#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, ans = 0, len = 0;
  cin >> n;
  int a[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  reverse(a, a + n);
  set<int> s;
  for (i = 0; i < n; i++) s.insert(a[i]);
  vector<int> b;
  cout << s.size() << "\n";
  for (i = 0; i < n; i++) {
    if (s.find(a[i]) != s.end()) {
      b.push_back(a[i]);
      s.erase(a[i]);
    }
  }
  reverse(b.begin(), b.end());
  for (int x : b) cout << x << " ";
  return 0;
}
