#include <bits/stdc++.h>
const int N = 100000 + 5;
int n;
bool vis[N];
int a[N], order[N], to[N];
bool is_lucky(int n) {
  while (n) {
    if (n % 10 != 4 && n % 10 != 7) {
      return false;
    }
    n /= 10;
  }
  return true;
}
bool cmp(int i, int j) {
  if (a[i] != a[j]) {
    return a[i] < a[j];
  }
  return i < j;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  bool ordered = true;
  for (int i = 1; i < n; i++) {
    ordered &= a[i - 1] <= a[i];
  }
  if (ordered) {
    puts("0");
  } else {
    int start = 0;
    while (start < n && !is_lucky(a[start])) {
      start++;
    }
    if (start >= n) {
      puts("-1");
    } else {
      for (int i = 0; i < n; i++) {
        order[i] = i;
      }
      std::sort(order, order + n, cmp);
      for (int i = 0; i < n; i++) {
        to[order[i]] = i;
      }
      std::fill(vis, vis + n, false);
      vis[start] = true;
      std::vector<std::pair<int, int> > answer(0);
      for (int i = start; order[i] != start; i = order[i]) {
        vis[order[i]] = true;
        if (i != order[i]) {
          answer.push_back({i, order[i]});
        }
      }
      start = to[start];
      for (int i = 0; i < n; i++)
        if (!vis[i]) {
          answer.push_back({start, i});
          vis[i] = true;
          for (int j = i; order[j] != i; j = order[j]) {
            vis[order[j]] = true;
            if (j != order[j]) {
              answer.push_back({j, order[j]});
            }
          }
          answer.push_back({to[i], start});
        }
      printf("%d\n", answer.size());
      for (int i = 0; i < answer.size(); i++) {
        printf("%d %d\n", answer[i].first + 1, answer[i].second + 1);
      }
    }
  }
  return 0;
}
