#include <bits/stdc++.h>
using namespace std;
bool isLucky(int n) {
  while (n > 0) {
    if (n % 10 != 4 && n % 10 != 7) return false;
    n /= 10;
  }
  return true;
}
const int MN = 100111;
int n, pos[MN], x[MN];
pair<int, int> a[MN];
vector<pair<int, int> > res;
bool increasing() {
  for (int i = (2), _b = (n); i <= _b; i++)
    if (a[i].first < a[i - 1].first) return false;
  return true;
}
void move(int i, int j) {
  swap(x[i], x[j]);
  pos[x[i]] = i;
  pos[x[j]] = j;
  res.push_back(make_pair(i, j));
}
int main() {
  while (scanf("%d", &n) == 1) {
    for (int i = (1), _b = (n); i <= _b; i++) {
      scanf("%d", &a[i].first);
      a[i].second = i;
    }
    if (increasing())
      cout << 0 << endl;
    else {
      int firstLucky = -1;
      for (int i = (1), _b = (n); i <= _b; i++)
        if (isLucky(a[i].first)) {
          firstLucky = i;
          break;
        }
      if (firstLucky < 0) {
        cout << -1 << endl;
      } else {
        sort(a + 1, a + n + 1);
        for (int i = (1), _b = (n); i <= _b; i++) x[a[i].second] = i;
        for (int i = (1), _b = (n); i <= _b; i++) pos[x[i]] = i;
        res.clear();
        int firstValue = x[firstLucky];
        for (int i = (1), _b = (n); i <= _b; i++)
          if (i != firstValue) {
            if (x[i] == i) continue;
            if (firstLucky == i) {
              firstLucky = pos[i];
              move(i, pos[i]);
            } else {
              move(i, firstLucky);
              firstLucky = pos[i];
              move(i, pos[i]);
            }
          }
        printf("%d\n", res.size());
        for (auto x : res) printf("%d %d\n", x.first, x.second);
      }
    }
  }
  return 0;
}
