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