#include <bits/stdc++.h>
using namespace std;
long long int mod = 1000000007;
long long int mod1 = 998244353;
vector<long long int> g[100000 + 5];
bool vis[100000 + 5];
long long int d, x, y;
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void ex(long long int A, long long int B) {
  if (B == 0) {
    d = A;
    x = 1;
    y = 0;
  } else {
    ex(B, A % B);
    long long int temp = x;
    x = y;
    y = temp - (A / B) * y;
  }
}
void dfs(long long int u) {
  vis[u] = 1;
  for (long long int i = 0; i < g[u].size(); i++) {
    long long int v = g[u][i];
    if (vis[v] != 1) dfs(v);
  }
}
long long int power(long long int a, long long int b) {
  if (b == 1) return a;
  if (a > mod) a %= mod;
  long long int r = 1;
  while (b) {
    if (b & 1) r = r % mod * a % mod;
    a = a % mod * a % mod;
    b /= 2;
  }
  return r;
}
class uf {
  vector<long long int> v;
  vector<long long int> sz;

 public:
  uf(long long int n) {
    v.resize(n + 1);
    iota(v.begin() + 1, v.end(), 1);
    sz.resize(n + 1, 1);
  }
  long long int root(long long int b) {
    while (v[b] != b) {
      b = v[b];
    }
    return b;
  }
  void u(long long int a, long long int b) {
    long long int ra = root(a);
    long long int rb = root(b);
    if (ra == rb) return;
    if (sz[ra] < sz[rb]) {
      v[ra] = v[rb];
      sz[rb] += sz[ra];
    } else {
      v[rb] = v[ra];
      sz[ra] += sz[rb];
    }
  }
  bool first(long long int a, long long int b) { return (root(a) == root(b)); }
};
vector<long long int> matmul(vector<long long int> a, vector<long long int> b) {
  vector<long long int> c(4, 0);
  c[0] = (a[0] % mod * b[0] % mod + a[1] % mod * b[2] % mod) % mod;
  c[1] = (a[0] % mod * b[1] % mod + a[1] % mod * b[3] % mod) % mod;
  c[2] = (a[2] % mod * b[0] % mod + a[3] % mod * b[2] % mod) % mod;
  c[3] = (a[2] % mod * b[1] % mod + a[3] % mod * b[3] % mod) % mod;
  return c;
}
vector<long long int> id = {1, 0, 0, 1};
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n;
  cin >> n;
  vector<long long int> v(n);
  for (long long int i = 0; i < n; i++) cin >> v[i];
  map<long long int, bool> m;
  vector<long long int> ans;
  for (long long int i = n - 1; i >= 0; i--) {
    if (m[v[i]] == 1)
      continue;
    else {
      ans.push_back(v[i]);
      m[v[i]] = 1;
    }
  }
  reverse(ans.begin(), ans.end());
  cout << ans.size() << "\n";
  for (auto i : ans) cout << i << " ";
}
