#include <bits/stdc++.h>
int main() {
  int32_t n;
  std::cin >> n;
  int32_t* arr = new int32_t[n];
  for (int32_t i = 0; i < n; i++) std::cin >> arr[i];
  std::set<int32_t> met;
  std::vector<int32_t> ans;
  for (int32_t i = n - 1; i >= 0; i--) {
    if (met.find(arr[i]) == met.end()) ans.push_back(arr[i]);
    met.insert(arr[i]);
  }
  std::reverse(ans.begin(), ans.end());
  std::cout << ans.size() << "\n";
  for (int32_t i = 0; i < ans.size(); i++) std::cout << ans[i] << " ";
  return 0;
}
