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