#include <bits/stdc++.h>
using namespace std;
const int oo = 0x3f3f3f3f;
long long fastpower(long long b, long long p) {
  long long ans = 1;
  while (p) {
    if (p % 2) {
      ans = (ans * b);
    }
    b = (b * b);
    p /= 2;
  }
  return ans;
}
string makeitstring(long long n) {
  string ans;
  while (n) {
    long long mod = n % 10;
    mod += 48;
    char m = mod;
    ans = m + ans;
    n /= 10;
  }
  return ans;
}
long long makeitnumber(string s) {
  long long ans = 0;
  for (long long i = 0; i < s.size(); i++) {
    long long num = s[i] - '0';
    ans += (num * fastpower(10, (long long)s.size() - i - 1));
  }
  return ans;
}
bool valid(int x, int y, int n, int m) {
  return (x >= 0 && y < m && x < n && y >= 0);
}
double EPS = 0.000000000001;
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int n;
  cin >> n;
  int arr[n];
  map<int, int> m;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    m[arr[i]] = i;
  }
  cout << m.size() << endl;
  for (int i = 0; i < n; i++) {
    if (m[arr[i]] == i) {
      cout << arr[i] << " ";
    }
  }
  return 0;
}
