#include <bits/stdc++.h>
using namespace std;
int f(int n) {
  int s = 1;
  while (n) {
    if (n % 10 != 4 && n % 10 != 7) {
      s = 0;
      break;
    }
    n /= 10;
  }
  return s;
}
int main() {
  int n;
  cin >> n;
  pair<int, int> a[n];
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    a[i] = {x, i};
  }
  sort(a, a + n);
  int j = -1, l = 1;
  j = -1;
  for (int i = 0; i < n; i++) {
    if (a[i].second != i) l = 0;
    if (f(a[i].first) && a[i].first != 0) {
      j = i;
      break;
    }
  }
  if (l == 1) {
    cout << "0";
    return 0;
  }
  if (j == -1) {
    cout << -1;
    return 0;
  }
  vector<pair<int, int> > v;
  int p[n];
  for (int i = 0; i < n; i++) p[i] = 0;
  int u = a[j].second;
  p[u] = 1;
  while (p[a[u].second] == 0) {
    v.push_back({u, a[u].second});
    u = a[u].second;
    p[u] = 1;
  }
  j = u;
  for (int i = 0; i < n; i++) {
    if (p[i] == 0 && a[i].second != i) {
      int u = i;
      v.push_back({j, u});
      p[u] = 1;
      while (p[a[u].second] == 0) {
        v.push_back({u, a[u].second});
        u = a[u].second;
        p[u] = 1;
      }
      v.push_back({j, u});
    }
  }
  cout << v.size() << endl;
  for (int i = 0; i < v.size(); i++) {
    cout << v[i].first + 1 << " " << v[i].second + 1 << endl;
  }
}
