#include <bits/stdc++.h>
using namespace std;
map<int, int> mm;
map<int, int>::iterator it;
int x[100005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<int> v;
  for (int i = 1; i <= n; i++) cin >> x[i];
  for (int i = n; i >= 1; i--) {
    if (mm[x[i]] == 0) {
      mm[x[i]]++;
      v.push_back(x[i]);
    }
  }
  cout << endl;
  cout << v.size() << "\n";
  for (int i = v.size() - 1; i >= 0; i--) {
    cout << v[i] << " ";
  }
}
