#include <bits/stdc++.h>
using namespace std;
int n, a, t;
int geldi[(int)(1e6) + 1];
int32_t main() {
  cin >> n;
  unordered_map<int, int> mp;
  vector<int> says;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a);
    mp[a]++;
    says.push_back(a);
  }
  vector<int> usable;
  for (int i = 1; i <= (int)(1e6); i++) {
    if (!mp[i] && !mp[(int)(1e6) - i + 1]) usable.push_back(i);
  }
  int ka = 0;
  vector<int> ans;
  for (auto j : says) {
    if (geldi[j]) continue;
    if (mp[(int)(1e6) - (j - 1)]) {
      geldi[(int)(1e6) - (j - 1)] = true;
      ans.push_back(usable[ka]);
      ans.push_back((int)(1e6) - usable[ka] + 1);
      ka++;
    } else
      ans.push_back((int)(1e6) - (j - 1));
  }
  printf("%d \n", (int)ans.size());
  for (auto j : ans) {
    printf("%d ", j);
  }
}
