#include <bits/stdc++.h>
using namespace std;
bool luckyNum(int n) {
  if (n == 0) return false;
  while (n != 0) {
    if (n % 10 != 4 && n % 10 != 7) {
      return false;
    }
    n /= 10;
  }
  return true;
}
int main() {
  int n;
  vector<pair<int, int> > ele, sortedEle;
  vector<pair<int, int> > p;
  while (scanf("%d", &n) == 1) {
    ele.clear();
    sortedEle.clear();
    p.clear();
    int luckyInd = -1;
    for (int _i = 0, i = _i; i < n; i++) {
      int x;
      scanf("%d", &x);
      if (luckyInd == -1 && luckyNum(x)) {
        luckyInd = i;
      }
      ele.push_back(make_pair(x, 0));
      sortedEle.push_back(make_pair(x, i));
    }
    sort(sortedEle.begin(), sortedEle.end());
    if (luckyInd == -1) {
      bool check = true;
      for (int _i = 0, i = _i; i < n; i++) {
        if (ele[i].first != sortedEle[i].first) {
          check = false;
          printf("-1\n");
          break;
        }
      }
      if (check) printf("0\n");
      continue;
    }
    for (int _i = 0, i = _i; i < n; i++) {
      ele[sortedEle[i].second].second = i;
    }
    luckyInd = ele[luckyInd].second;
    for (int _i = 0, i = _i; i < n; i++) {
      if (ele[i] == sortedEle[i]) continue;
      if (sortedEle[luckyInd].second != i)
        p.push_back(make_pair(sortedEle[luckyInd].second + 1, i + 1));
      swap(ele[sortedEle[luckyInd].second], ele[i]);
      sortedEle[ele[sortedEle[luckyInd].second].second].second =
          sortedEle[luckyInd].second;
      sortedEle[luckyInd].second = i;
      if (i != sortedEle[i].second)
        p.push_back(make_pair(i + 1, sortedEle[i].second + 1));
      swap(ele[i], ele[sortedEle[i].second]);
      sortedEle[luckyInd].second = sortedEle[i].second;
      sortedEle[i].second = i;
    }
    printf("%d\n", p.size());
    for (int _i = 0, i = _i; i < p.size(); i++) {
      printf("%d %d\n", p[i].first, p[i].second);
    }
  }
}
