#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DEBUG 1
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) if(DEBUG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DEBUG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
using ll = long long; using ull = unsigned long long; using pii = pair<int, int>;
static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
static const int MOD = 1e9 + 7;

signed main() {
	for (int n; cin >> n&&n;) {
		vector<int> a(n);
		string ans = "";
		rep(i, 0, n)cin >> a[i];
		rep(i, 0, n) {
			int cnt = 0;
			rep(j, i, n - 1) {
				if (a[j] + 1 == a[j + 1])cnt++;
				else break;
			}
			if (cnt >= 1) {
				ans += to_string(a[i]) + "-" + to_string(a[i + cnt]) + " ";
			}
			else {
				rep(j, i, i + cnt + 1) {
					ans += to_string(a[j]) + " ";
				}
			}
			i += cnt;
		}
		cout << ans.substr(0, ans.size() - 1) << endl;
	}
	return 0;
}