#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
using ll = long long;
using lld = long double;
const int oo = 0x3f3f3f3f;
const ll MOD = 1000000007;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> ar(n);
  for (int& i : ar) cin >> i;
  reverse(ar.begin(), ar.end());
  vector<int> ans;
  set<int> hs;
  for (int i = 0; i < n; i++) {
    int x = ar[i];
    if (hs.count(x))
      continue;
    else {
      hs.insert(x);
      ans.push_back(x);
    }
  }
  reverse(ans.begin(), ans.end());
  cout << ((int)(ans).size()) << '\n';
  for (int i : ans) cout << i << " ";
  cout << '\n';
  return 0;
}
