#include <bits/stdc++.h>
using namespace std;
struct fff {
  int id, s;
} pp[100010];
bool cmp(fff a, fff b) { return a.s < b.s; }
bool judge(int x) {
  if (x == 0) return false;
  while (x) {
    if (x % 10 != 4 && x % 10 != 7) return false;
    x /= 10;
  }
  return true;
}
int need[100010];
int change[100010];
bool vis[100010];
int mark;
vector<pair<int, int> > ans;
int main() {
  int n;
  scanf("%d", &n);
  bool flag = true;
  for (int i = 0; i < n; i++) {
    scanf("%d", &pp[i].s);
    pp[i].id = i;
    if (i && pp[i].s < pp[i - 1].s) flag = false;
  }
  if (flag) {
    printf("0\n");
    return 0;
  }
  int mark = -1;
  for (int i = 0; i < n; i++)
    if (judge(pp[i].s)) mark = i;
  sort(pp, pp + n, cmp);
  if (mark == -1) {
    printf("-1");
    return 0;
  }
  for (int i = 0; i < n; i++) need[i] = pp[i].id, change[pp[i].id] = i;
  ;
  memset(vis, false, sizeof(vis));
  ans.clear();
  if (need[mark] != mark) {
    int pre = mark;
    while (!vis[need[pre]]) {
      vis[pre] = true;
      ans.push_back(make_pair(pre, need[pre]));
      pre = need[pre];
    }
    vis[pre] = true;
  }
  mark = change[mark];
  for (int i = 0; i < n; i++) {
    if (vis[i]) continue;
    if (need[i] == i) continue;
    int pre = i;
    ans.push_back(make_pair(mark, pre));
    while (!vis[need[pre]]) {
      vis[pre] = true;
      ans.push_back(make_pair(pre, need[pre]));
      pre = need[pre];
    }
    vis[pre] = true;
    ans.push_back(make_pair(mark, pre));
  }
  int len = ans.size();
  printf("%d\n", len);
  for (int i = 0; i < len; i++)
    printf("%d %d\n", ans[i].first + 1, ans[i].second + 1);
  return 0;
}
