#include <bits/stdc++.h>
using namespace std;
string ans;
map<pair<string, int>, int> dp;
bool check(string second) {
  int mul = 1;
  int num = 0;
  int i = second.size() - 1;
  num = num + ((second[i] - '0') * 1) % 8;
  i--;
  if (second.size() > 1) {
    num = num + ((second[i] - '0') * 10) % 8;
  }
  i--;
  if (second.size() > 2) {
    num = num + ((second[i] - '0') * 100) % 8;
  }
  if (num % 8 == 0) {
    ans = second;
    return true;
  } else {
    return false;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  int a[n];
  vector<int> v[1001];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    v[a[i]].push_back(i);
  }
  vector<int> ans;
  for (int i = 1; i < 1001; i++) {
    if (v[i].size() > 0) ans.push_back(v[i][v[i].size() - 1]);
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) {
    cout << a[ans[i]] << " ";
  }
  return 0;
}
