#include <bits/stdc++.h>
using namespace std;
const long long N = 10e5 + 5;
long long ans, sum, cnt, mn = N, mx = -N, ser, fer, kel;
long long a[N];
vector<long long> v;
vector<long long> r;
set<long long> st;
map<long long, long long> mp;
pair<long long, long long> p[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n, c;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> c;
    v.push_back(c);
  }
  reverse(v.begin(), v.end());
  for (long long i = 0; i < n; i++) {
    mp[v[i]]++;
    if (mp[v[i]] == 1) {
      r.push_back(v[i]);
    }
  }
  reverse(r.begin(), r.end());
  cout << r.size() << endl;
  for (long long i = 0; i < r.size(); i++) {
    cout << r[i] << " ";
  }
}
