#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int nmax = 1000005;
const long long inf = 1e9;
const double eps = 1e-6;
const long long pw = 31;
set<int> s;
int used[nmax];
set<pair<int, int> > con;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d", &x);
    used[x] = 1;
  }
  for (int i = 1; i <= 500000; ++i) {
    if (!used[i] && !used[1000000 - i + 1]) {
      con.insert({i, 1000000 - i + 1});
    }
  }
  for (int i = 1; i <= 1000000; ++i) {
    if (used[i]) {
      if (!used[1000000 - i + 1]) {
        s.insert(1000000 - i + 1);
      } else {
        used[i] = 0;
        used[1000000 - i + 1] = 0;
        pair<int, int> f = *con.begin();
        s.insert(f.first);
        s.insert(f.second);
        con.erase(con.begin());
      }
    }
  }
  int sz = s.size();
  printf("%d\n", sz);
  for (set<int>::iterator it = s.begin(); it != s.end(); ++it)
    printf("%d ", *it);
  printf("\n");
  return 0;
}
