#include <bits/stdc++.h>
using namespace std;
const int maxN = 100 * 1000 + 5;
const int inf = 1000 * 1000 * 1000;
int a[maxN];
int b[maxN];
int ps[maxN];
pair<int, int> p[maxN];
int n;
int mp(int t) {
  int ps = lower_bound(b, b + n, t) - b;
  return ps;
}
bool check(int t) {
  while (t) {
    if (t % 10 != 4 && t % 10 != 7) return false;
    t /= 10;
  }
  return true;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++)
    cin >> a[i], b[i] = a[i], p[i].first = a[i], p[i].second = i;
  sort(b, b + n);
  sort(p, p + n);
  int fl = 1;
  for (int i = 0; i < n; i++)
    if (a[i] != b[i]) {
      fl = 0;
      break;
    }
  if (fl) {
    cout << 0 << endl;
    return 0;
  }
  int ind = -1;
  for (int i = 0; i < n; i++)
    if (check(a[i])) {
      ind = i;
      break;
    }
  if (ind == -1) {
    cout << -1 << endl;
    return 0;
  }
  int cur = p[0].first + 1;
  for (int i = 1; i < n; i++) {
    if (cur > p[i].first)
      a[p[i].second] = cur, cur++;
    else
      cur = p[i].first + 1;
  }
  for (int i = 0; i < n; i++) b[i] = a[i];
  sort(b, b + n);
  for (int i = 0; i < n; i++) ps[mp(a[i])] = i;
  vector<pair<int, int> > ans;
  for (int i = 0; i < n; i++) {
    if (mp(a[i]) == i) continue;
    if (b[i] == a[ind]) {
      fl = 1;
      continue;
    }
    if (i != ind) {
      ans.push_back(make_pair(i, ind));
      swap(ps[mp(a[i])], ps[mp(a[ind])]);
      swap(a[i], a[ind]);
    }
    ans.push_back(make_pair(i, ps[mp(b[i])]));
    int tmp = ps[mp(b[i])];
    ps[mp(a[i])] = tmp;
    ps[mp(b[i])] = i;
    swap(a[i], a[tmp]);
    ind = tmp;
  }
  cout << ans.size() << endl;
  for (auto v : ans) cout << v.first + 1 << ' ' << v.second + 1 << endl;
  return 0;
}
