#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int many;
  cin >> many;
  int arr[many];
  for (int i = 0; i < many; i++) cin >> arr[i];
  set<int> sethcurry;
  vector<int> vec;
  for (int i = many - 1; i >= 0; i--) {
    int temp = arr[i];
    if (!sethcurry.count(temp)) {
      vec.push_back(temp);
      sethcurry.insert(temp);
    }
  }
  cout << vec.size() << endl;
  for (int i = vec.size() - 1; i >= 0; i--) cout << vec[i] << " ";
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << " ms\n";
  return 0;
}
