#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  map<long long int, long long int> m;
  for (int i = 0; i < n; i++) {
    m[a[i]] = i;
  }
  vector<long long int> v;
  for (auto i : m) {
    v.push_back(i.second);
  }
  sort(v.begin(), v.end());
  cout << v.size() << endl;
  for (auto i : v) {
    cout << a[i] << " ";
  }
}
