#include <bits/stdc++.h>
using namespace std;
const int mid = 500000;
int a[500010], cnt[500010];
int n;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    if (a[i] <= mid)
      cnt[a[i]]++;
    else
      cnt[mid * 2 + 1 - a[i]]++;
  }
  int j = 1;
  printf("%d\n", n);
  for (int i = 1; i <= n; i++) {
    int x;
    if (a[i] <= mid)
      x = a[i];
    else
      x = mid * 2 + 1 - a[i];
    if (cnt[x] == 1)
      printf("%d ", mid * 2 + 1 - a[i]);
    else {
      if (a[i] > mid) continue;
      while (cnt[j]) j++;
      printf("%d %d ", j, mid * 2 + 1 - j);
      j++;
    }
  }
  return 0;
}
