#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 10;
long long n, m, a[N], b[N], s[N], k = 0, l = 0, i, j = 0, mn = N, mx = -N,
                                  ans = 0, r1 = 0, r2 = 0, r3 = 0, t, q;
string d1, d3, d2;
pair<long long, long long> g[N];
char lk, kl;
int main() {
  cin >> n;
  for (i = 0; i < n; i++) cin >> b[i];
  for (i = 0; i < n; i++) {
    l = b[n - 1 - i];
    s[l]++;
    if (s[l] == 1) {
      a[ans] = l;
      ans++;
    }
  }
  cout << ans << "\n";
  for (i = ans - 1; i >= 0; i--) cout << a[i] << " ";
}
