#include <bits/stdc++.h>   using namespace std;   struct rec {     int x, p;   } a[101];   vector<rec> ans;   int n;   bool was[101];   bool cmp(rec a, rec b) { return a.x > b.x; }   void dfs(int v) {     was[v] = true;     for (int i = v + 1; i < n; ++i) {       if (a[v].x == 0) break;       if (!was[i]) {         a[v].x--;         rec r;         r.x = a[v].p;         r.p = a[i].p;         ans.push_back(r);         dfs(i);       }     }   }   int main() {     cin >> n;     for (int i = 0; i < n; ++i) {       cin >> a[i].x;       a[i].p = i;     }     sort(a + 1, a + n, cmp);     dfs(0);     for (int i = 0; i < n; ++i)       if (!was[i]) {         cout << -1;         return 0;       }     cout << ans.size() << endl;     for (int i = 0; i < ans.size(); ++i) {       cout << ans[i].x + 1 <<     << ans[i].p + 1 << endl;     }     return 0;   }   