#include <bits/stdc++.h>
using namespace std;
const int MAX = 123456;
int N;
pair<int, int> ip[MAX], op[MAX];
vector<pair<int, int> > ans;
bool vt[MAX];
vector<int> loop;
bool isl(int t) {
  while (t) {
    if ((t % 10 != 4) && (t % 10 != 7)) {
      return false;
    }
    t /= 10;
  }
  return true;
}
void push(int a, int b) {
  if (a != b) {
    ans.push_back((make_pair((a), (b))));
  }
}
int main() {
  scanf("%d", &N);
  int luc = -1;
  for (int(i) = 0; (i) < (N); (i)++) {
    scanf("%d", &ip[i].first);
    ip[i].second = i;
    if (luc == -1) {
      if (isl(ip[i].first)) {
        luc = i;
      }
    }
    op[i] = ip[i];
  }
  sort(op, op + N);
  for (int(i) = 0; (i) < (N); (i)++) {
    ip[op[i].second].second = i;
  }
  if (luc == -1) {
    bool spf = 1;
    for (int(i) = 0; (i) < (N); (i)++) {
      if (ip[i].second != i) {
        spf = 0;
        break;
      }
    }
    spf ? puts("0") : puts("-1");
    return 0;
  }
  push(luc, ip[luc].second);
  int nlp = ip[luc].second;
  swap(ip[luc], ip[ip[luc].second]);
  for (int(i) = 0; (i) < (N); (i)++) {
    if (!vt[i]) {
      loop.clear();
      vt[i] = 1;
      loop.push_back((i));
      int t = i;
      while (!vt[ip[t].second]) {
        t = ip[t].second;
        vt[t] = 1;
        loop.push_back((t));
      }
      if (loop.size() > 1) {
        push(nlp, loop[0]);
        int tp = loop[0];
        for (int j = loop.size() - 1; j > 0; j--) {
          push(tp, loop[j]);
          tp = loop[j];
        }
        push(loop[1], nlp);
      }
    }
  }
  printf("%d\n", ans.size());
  for (int(i) = 0; (i) < (ans.size()); (i)++) {
    printf("%d %d\n", ans[i].first + 1, ans[i].second + 1);
  }
}
