#include <bits/stdc++.h>
using namespace std;
bool tag[1000006];
bool done[1000006];
vector<int> ans;
int i = 0, j = 999999;
int arr[500005];
int main() {
  int n;
  scanf("%d", &n);
  for (int i1 = 0; i1 <= (n - 1); i1++) {
    scanf("%d", &arr[i1]);
    tag[arr[i1] - 1] = true;
  }
  int sent = 999999;
  sort(arr, arr + n);
  for (int i1 = 0; i1 <= (n - 1); i1++) {
    int v = arr[i1];
    v--;
    if (done[v]) continue;
    if (!tag[sent - v]) {
      ans.push_back(sent - v + 1);
      tag[sent - v] = true;
      done[v] = true;
      continue;
    }
    while (tag[i] || tag[j]) {
      i++, j--;
    }
    ans.push_back(i + 1);
    ans.push_back(j + 1);
    done[v] = done[sent - v] = true;
    tag[i] = tag[j] = true;
  }
  cout << ans.size() << endl;
  int l = ans.size();
  for (int i = 0; i <= (l - 1); i++) cout << ans[i] << " ";
  return 0;
}
