#include <bits/stdc++.h>
using namespace std;
template <class T>
using q_min = priority_queue<T, vector<T>, greater<T>>;
const int mod = 1000000007;
unsigned long long power(unsigned long long x, unsigned long long n,
                         unsigned long long m = mod) {
  unsigned long long res = 1;
  while (n) {
    if (n & 1) {
      res = res * x % m;
    }
    x = x * x % m;
    n >>= 1;
  }
  return (res % m);
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  unsigned long long tt = 1, n, k, x, y, z, i, j;
  while (tt--) {
    cin >> n;
    map<unsigned long long, unsigned long long> m;
    vector<unsigned long long> v(n);
    for (unsigned long long i = 0; i < n; i++) {
      cin >> x;
      v[i] = x;
      m[x]++;
    }
    queue<unsigned long long> q;
    vector<unsigned long long> vis(1000000, 0);
    for (unsigned long long i = 1; i <= 500000; i++) {
      if (m.find(i) == m.end() && m.find(1000000 - i + 1) == m.end()) {
        q.push(i);
      }
    }
    vector<unsigned long long> ans;
    for (unsigned long long i = 0; i < n; i++) {
      if (vis[v[i]]) continue;
      if (m.find(1000000 - v[i] + 1) == m.end()) {
        vis[v[i]] = 1;
        ans.push_back(1000000 - v[i] + 1);
      } else {
        x = q.front();
        q.pop();
        vis[v[i]] = 1;
        vis[1000000 - v[i] + 1] = 1;
        ans.push_back(x);
        ans.push_back(1000000 - x + 1);
      }
    }
    cout << ans.size() << endl;
    for (auto x : ans) cout << x << " ";
  }
}
