#include <bits/stdc++.h>
using namespace std;
int arr[100005], n, ans[200005];
int s, e;
int main() {
  cin >> n;
  for (int i = (0); i < (n); ++i) cin >> arr[i];
  sort(arr, arr + n, greater<int>());
  s = 100000, e = 100000;
  ans[s] = arr[0];
  for (int i = (1); i < (n); ++i) {
    if (arr[i] < ans[s]) {
      ans[--s] = arr[i];
    } else if (ans[e] > arr[i]) {
      ans[++e] = arr[i];
    }
  }
  printf("%d\n", e - s + 1);
  for (int i = (s); i < (e); ++i) printf("%d ", ans[i]);
  printf("%d\n", ans[e]);
  return 0;
}
