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=1;i<=n;i++){
			if(a[i-1]-a[i]+1) {
				i-p-1?printf(n-i?"%d-%d ":"%d-%d\n",a[p],a[i-1]):printf(n-i?"%d ":"%d\n",a[p]);p=i;
			}
		}
	}
	exit(0);
}