#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  set<int> s;
  vector<int> ans;
  for (int i = n - 1; i >= 0; i--) {
    if (s.find(arr[i]) == s.end()) {
      ans.push_back(arr[i]);
      s.insert(arr[i]);
    }
  }
  cout << ans.size() << "\n";
  for (int i = ans.size() - 1; i >= 0; i--) {
    cout << ans[i] << " ";
  }
}
