#include <bits/stdc++.h>
using namespace std;
int data[1000001];
int Answer[1000001];
int trololo[500001];
int main() {
  int N;
  scanf("%d", &N);
  memset(data, 0, 1000001 * sizeof(int));
  int ii, count = 0;
  for (int i = 0; i < N; ++i) {
    scanf("%d", &ii);
    data[ii] = 1;
    trololo[i] = ii;
  }
  int kk = 1;
  for (int i = 0; i < N; ++i) {
    if (data[trololo[i]]) {
      if (data[1000001 - trololo[i]]) {
        while (data[1000001 - kk] || data[kk]) {
          ++kk;
        }
        Answer[count] = 1000001 - kk;
        data[1000001 - kk] = 1;
        ++count;
        Answer[count] = kk;
        data[kk] = 1;
        ++count;
        data[1000001 - trololo[i]] = 0;
      } else {
        Answer[count] = 1000001 - trololo[i];
        ++count;
      }
    }
  }
  printf("%d\n", count);
  long long ss = 0;
  for (int i = 0; i < count; ++i) {
    printf("%d ", Answer[i]);
  }
  return 0;
}
