#include <cstdio>
using namespace std;

int main(){
	int n, a[26];
	while (scanf("%d", &n), n != 0) {
		for (int i = 0; i < n; i++) {
			scanf(" %d", &a[i]);
		}
		printf("31\n");
		int o = 31, it = 0;
		while (o > 5) {
		printf("%d\n%d\n", o - a[it], o - 5);
		o -= 5;
		if (++it >= n)
			it = 0;
		}
		printf("0\n");
	}

	return 0;
}