#include <bits/stdc++.h>
using namespace std;
const int MaxN = 1000000 + 10, S = 1000000;
bool use[MaxN], nf[MaxN];
int n, nd[MaxN], X[MaxN];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &X[i]);
  for (int i = 1; i <= n; ++i) use[X[i]] = true;
  for (int i = 1; i <= n; ++i) ++nd[S - X[i] + 1];
  for (int l = 500000, r = 500001; l > 1; --l, ++r) {
    if (nd[l] && !use[l]) {
      --nd[l];
      nf[l] = use[l] = 1;
    }
    if (nd[r] && !use[r]) {
      --nd[r];
      nf[r] = use[r] = 1;
    }
    nd[l - 1] += nd[l];
    nd[r + 1] += nd[r];
    nd[l] = nd[r] = 0;
  }
  for (int l = 1, r = S; l <= 500000; ++l, --r) {
    if (nd[l] && !use[l]) {
      --nd[l];
      nf[l] = use[l] = 1;
    }
    if (nd[r] && !use[r]) {
      --nd[r];
      nf[r] = use[r] = 1;
    }
    nd[l + 1] += nd[l];
    nd[r - 1] += nd[r];
    nd[l] = nd[r] = 0;
  }
  int tot = 0;
  for (int i = 1; i <= S; ++i)
    if (nf[i]) ++tot;
  printf("%d\n", tot);
  for (int i = 1; i <= S; ++i)
    if (nf[i]) printf("%d ", i);
  printf("\n");
  return 0;
}
