n,p,i,a[51];
main(){
	for(;~scanf("%d", &n),n;) {
		for(a[n]=p=i=0;i<n;i++)scanf("%d",&a[i]);
		for(i=0;i<n;i++){
			if(a[i]+1!=a[i+1]) {
				if(i-p)printf(n-i-1?"%d-%d ":"%d-%d\n",a[p],a[i]);
				else printf(n-i-1?"%d ":"%d\n",a[p]);
				p=i+1;
			}
		}
	}
	exit(0);
}