#include <bits/stdc++.h>
using namespace std;
int n, numlucky, luckypos;
int a[100000];
int order[100000];
int orderpos[100000];
bool lucky[100000];
vector<pair<int, int> > va;
vector<int> myout;
void myswap(int i, int j) {
  if (i != j) {
    swap(a[i], a[j]);
    swap(order[i], order[j]);
    swap(orderpos[order[i]], orderpos[order[j]]);
    myout.push_back(i + 1);
    myout.push_back(j + 1);
    if (luckypos == i)
      luckypos = j;
    else if (luckypos == j)
      luckypos = i;
  }
}
int main() {
  cin >> n;
  numlucky = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    va.push_back(make_pair(a[i], i));
    lucky[i] = true;
    int temp = a[i];
    while (temp > 0) {
      if (temp % 10 != 4 && temp % 10 != 7) lucky[i] = false;
      temp /= 10;
    }
    if (lucky[i]) {
      numlucky++;
      luckypos = i;
    }
  }
  bool sorted = true;
  for (int i = 1; i < n; ++i)
    if (a[i - 1] > a[i]) sorted = false;
  if (sorted) {
    cout << 0 << endl;
    return 0;
  }
  if (numlucky == 0) {
    cout << -1 << endl;
    return 0;
  }
  sort(va.begin(), va.end());
  for (int i = 0; i < n; ++i) {
    order[va[i].second] = i;
    orderpos[i] = va[i].second;
  }
  for (int i = 0; i < n; ++i) {
    myswap(luckypos, i);
    myswap(luckypos, orderpos[i]);
  }
  cout << (myout.size() / 2) << endl;
  for (int i = 0; i < myout.size(); i += 2) {
    cout << myout[i] << ' ' << myout[i + 1] << endl;
  }
  cin >> n;
}
