#include <bits/stdc++.h>
using namespace std;
void Tsukuyomi_() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (auto &x : a) cin >> x;
  vector<int> pos(1001, -1);
  for (int i = 0; i < n; i++) {
    pos[a[i]] = i;
  }
  vector<int> ans;
  for (int i = 0; i < n; i++) {
    if (pos[a[i]] == i) ans.push_back(a[i]);
  }
  cout << ans.size() << '\n';
  for (auto x : ans) cout << x << " ";
  cout << '\n';
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int tt = 1;
  while (tt--) Tsukuyomi_();
}
