#include <bits/stdc++.h>
using namespace std;
int N;
vector<int> in;
bool used[1000010];
bool done[1000010];
int lo = 1, hi = 1000000;
pair<int, int> next() {
  while (used[lo] || used[hi]) ++lo, --hi;
  pair<int, int> ret(lo, hi);
  ++lo, --hi;
  return ret;
}
vector<int> out;
int main() {
  scanf("%d", &N);
  in.resize(N);
  for (int i = 0; i < ((int)(in).size()); ++i)
    scanf("%d", &in[i]), used[in[i]] = true;
  for (int i = 0; i < ((int)(in).size()); ++i) {
    if (done[in[i]]) continue;
    int a = in[i], b;
    if (used[1000001 - in[i]]) {
      b = 1000001 - in[i];
      done[b] = true;
      pair<int, int> tmp = next();
      out.push_back(tmp.first), out.push_back(tmp.second);
    } else
      out.push_back(1000001 - in[i]), used[out.back()] = true;
  }
  printf("%d\n", ((int)(out).size()));
  for (int i = 0; i < ((int)(out).size()); ++i)
    printf("%d%c", out[i], (i + 1 == ((int)(out).size())) ? '\n' : ' ');
  return 0;
}
