#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int tt, n;
  tt = 1;
  while (tt--) {
    cin >> n;
    long long int a[n];
    set<long long int> s;
    vector<long long int> v;
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = n - 1; i > -1; i--) {
      if (s.find(a[i]) == s.end()) s.insert(a[i]), v.push_back(a[i]);
    }
    reverse(v.begin(), v.end());
    long long int p = v.size();
    cout << p << ("\n");
    for (int i = 0; i < p; i++) cout << v[i] << " ";
  }
  return 0;
}
