#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 10;
bool lucky(int x) {
  while (x) {
    if (x % 10 != 4 && x % 10 != 7) {
      return false;
    }
    x /= 10;
  }
  return true;
}
int id[maxn], a[maxn], pos[maxn], n;
bool f[maxn];
bool check() {
  for (int i = 0; i + 1 < n; ++i) {
    if (a[i + 1] < a[i]) {
      return false;
    }
  }
  return true;
}
bool comp(int x, int y) { return a[x] < a[y]; }
int main() {
  while (scanf("%d", &n) != EOF) {
    int c = -1;
    for (int i = 0; i < n; ++i) {
      scanf("%d", a + i);
      if (lucky(a[i])) c = i;
      id[i] = i;
    }
    if (c == -1) {
      printf("%d\n", check() ? 0 : -1);
      continue;
    }
    sort(id, id + n, comp);
    for (int i = 0; i < n; ++i) {
      pos[id[i]] = i;
      f[i] = false;
    }
    int posc = c;
    vector<pair<int, int> > ans;
    while (posc != pos[c]) {
      ans.push_back(pair<int, int>(posc, id[posc]));
      f[posc] = true;
      posc = id[posc];
    }
    f[posc] = true;
    for (int i = 0; i < n; ++i) {
      if (pos[i] != i && !f[i]) {
        ans.push_back(pair<int, int>(posc, i));
        int tmp = posc;
        posc = i;
        while (pos[i] != posc) {
          ans.push_back(pair<int, int>(posc, id[posc]));
          f[posc] = true;
          posc = id[posc];
        }
        f[posc] = true;
        ans.push_back(pair<int, int>(posc, tmp));
        posc = tmp;
      }
    }
    printf("%d\n", ((int)((ans).size())));
    for (int i = 0; i < ((int)((ans).size())); ++i) {
      printf("%d %d\n", ans[i].first + 1, ans[i].second + 1);
    }
  }
  return 0;
}
