#include <bits/stdc++.h>
using namespace std;
int const N = 110000;
int arr[N], perm[N], ori[N], pos[N];
bool cmp(int const& a, int const& b) { return arr[a] < arr[b]; }
int main() {
  vector<int> lucky;
  for (int n = 1; n <= 9; ++n) {
    for (int n_ = ((1 << (n))), msk = 0; msk < n_; ++msk) {
      int v = 0;
      for (int n_ = (n), i = 0; i < n_; ++i) {
        if ((1 << (i)) & msk) {
          v = v * 10 + 4;
        } else {
          v = v * 10 + 7;
        }
      }
      lucky.push_back(v);
    }
  }
  sort((lucky).begin(), (lucky).end());
  int n;
  while (scanf("%d", &n) == 1) {
    for (int n_ = (n), i = 0; i < n_; ++i) {
      scanf("%d", arr + i);
    }
    if (is_sorted(arr, arr + n)) {
      puts("0");
      puts("");
      continue;
    }
    for (int n_ = (n), i = 0; i < n_; ++i) ori[i] = arr[i];
    int pos_lucky = -1;
    for (int n_ = (n), i = 0; i < n_; ++i) {
      if (binary_search((lucky).begin(), (lucky).end(), arr[i])) {
        pos_lucky = i;
        break;
      }
    }
    if (pos_lucky == -1) {
      puts("-1");
      continue;
    }
    for (int n_ = (n), i = 0; i < n_; ++i) perm[i] = i;
    sort(perm, perm + n, cmp);
    for (int n_ = (n), i = 0; i < n_; ++i) arr[perm[i]] = i;
    vector<pair<int, int> > solution;
    int ilucky = arr[pos_lucky];
    for (int n_ = (n), i = 0; i < n_; ++i) {
      if (arr[i] != i) {
        solution.push_back(pair<int, int>(perm[ilucky], i));
        if (solution.back().first == solution.back().second)
          solution.pop_back();
        solution.push_back(pair<int, int>(perm[i], i));
        if (solution.back().first == solution.back().second)
          solution.pop_back();
        int a = i, b = perm[i], c = perm[ilucky];
        int va = arr[a], vb = arr[b], vc = arr[c];
        swap(arr[a], arr[c]);
        swap(arr[a], arr[b]);
        perm[arr[a]] = a;
        perm[arr[b]] = b;
        perm[arr[c]] = c;
      }
    }
    printf("%d\n", solution.size());
    for (int n_ = (solution.size()), i = 0; i < n_; ++i) {
      printf("%d %d\n", solution[i].first + 1, solution[i].second + 1);
      swap(ori[solution[i].first], ori[solution[i].second]);
    }
  }
  return 0;
}
