#include <bits/stdc++.h>
using namespace std;
const int M = 1000000007;
int main() {
  int n, i;
  cin >> n;
  int arr[1000001], color[1000001];
  for (i = 0; i < 1000001; i++) {
    arr[i] = 0;
    color[i] = 0;
  }
  vector<int> v(n), ans;
  for (i = 0; i < n; i++) {
    scanf("%d", &v[i]);
    arr[v[i]] = 1;
  }
  int j = 1;
  int s = 1000001;
  for (i = 0; i < n; i++) {
    if (color[v[i]] == 1) continue;
    if (arr[s - v[i]] == 0) {
      ans.push_back(s - v[i]);
      color[v[i]] = 1;
    } else {
      while ((arr[j] != 0 || arr[s - j] != 0) && j <= s) {
        j++;
      }
      if (j > s) {
        ans.push_back(s - 2);
      } else {
        ans.push_back(j);
        ans.push_back(s - j);
        arr[j] = 1;
        arr[s - j] = 1;
      }
      color[v[i]] = 1;
      color[s - v[i]] = 1;
    }
  }
  printf("%d\n", n);
  for (i = 0; i < n; i++) printf("%d ", ans[i]);
  printf("\n");
}
