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