#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  int arr[n];
  vector<int> v;
  map<int, int> mp;
  for (int i = 0; i < n; i++) scanf("%d", &arr[i]);
  for (int i = n - 1; i >= 0; i--) {
    if (mp[arr[i]] == 0) v.push_back(arr[i]);
    mp[arr[i]]++;
  }
  int len = v.size();
  printf("%d\n", len);
  for (int i = len - 1; i >= 0; i--) printf("%d ", v[i]);
}
