#include <bits/stdc++.h>
const int MAXN = 2 * 1e5 + 1;
int main() {
  int N;
  std::cin >> N;
  int a[N + 1];
  std::set<int> st;
  std::vector<int> v;
  for (int i = 1; i <= N; i++) {
    std::cin >> a[i];
  }
  for (int i = N; i >= 1; i--) {
    if (st.find(a[i]) == st.end()) {
      v.push_back(a[i]);
    }
    st.insert(a[i]);
  }
  std::cout << v.size() << std::endl;
  for (int i = v.size() - 1; i >= 0; i--) {
    std::cout << v[i] << ' ';
  }
  return 0;
}
