#include <bits/stdc++.h>
using namespace std;
int a[1000000 + 10];
int vis[1000000];
int ans[1000000];
int ok[1000000];
int n;
int main() {
  while (scanf("%d", &n) != EOF) {
    memset(vis, 0, sizeof(vis));
    for (int i = 1; i <= n; ++i) {
      scanf("%d", &a[i]);
      vis[a[i]] = 1;
    }
    int ans_c = 0;
    int cnt = 0;
    for (int i = 1; i <= 1000000 / 2; ++i)
      if (!vis[i] && !vis[1000000 - i + 1]) ok[++cnt] = i;
    for (int i = 1; i <= 1000000; ++i) {
      if (vis[i] && vis[i] != -1) {
        if (vis[1000000 - i + 1]) {
          ans[++ans_c] = ok[cnt];
          ans[++ans_c] = 1000000 - ok[cnt] + 1;
          cnt--;
          vis[1000000 - i + 1] = -1;
        } else {
          ans[++ans_c] = 1000000 - i + 1;
        }
      }
    }
    sort(ans + 1, ans + 1 + ans_c);
    printf("%d\n", ans_c);
    for (int i = 1; i <= ans_c; ++i)
      printf("%d%c", ans[i], i == ans_c ? '\n' : ' ');
  }
  return 0;
}
