#include <bits/stdc++.h>
using namespace std;
const int N = 100000;
bool aa[N];
int prime[N];
int num;
void Prime() {
  memset(aa, 0, sizeof(aa));
  int i, j;
  for (i = 2; i < N; ++i) {
    if (!(aa[i])) prime[num++] = i;
    for (j = 0; (j < num && i * prime[j] < N); ++j) {
      aa[i * prime[j]] = 1;
      if (!(i % prime[j])) break;
    }
  }
}
int vis[1100000];
int visb[1100000];
int a[1100000];
int main() {
  int n, i;
  while (~scanf("%d", &n)) {
    memset(vis, 0, sizeof(vis));
    memset(visb, 0, sizeof(visb));
    for (i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
      vis[a[i]] = 1;
    }
    sort(a + 1, a + n + 1);
    int pp = 0;
    for (i = 1; i <= 1000000; i++) {
      if (vis[i]) {
        if (vis[1000000 - i + 1]) {
          pp++;
        } else
          visb[1000000 - i + 1] = 1;
      }
    }
    pp = pp / 2;
    cout << n << endl;
    for (i = 1; i <= 1000000; i++) {
      if (visb[i]) cout << i << " ";
      if (!vis[i] && !vis[1000000 - i + 1] && pp) {
        cout << i << " " << 1000000 - i + 1 << " ";
        pp--;
      }
    }
    cout << endl;
  }
  return 0;
}
