#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, val;
  vector<int> ar;
  map<int, int> freq;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> val;
    ar.push_back(val);
  }
  for (int i = 0; i < n; ++i) {
    if (freq[ar[i]])
      ++freq[ar[i]];
    else
      freq[ar[i]] = 1;
  }
  cout << freq.size() << endl;
  for (int i = 0; i < n; ++i) {
    if (freq[ar[i]] == 1) {
      cout << ar[i] << " ";
    } else
      --freq[ar[i]];
  }
  return 0;
}
