#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const int inf = 0x3f3f3f3f;
const long long inf64 = 0x3f3f3f3f3f3f3f3fLL;
const double oo = 10e9;
const double eps = 10e-9;
const double pi = acos(-1.0);
const int maxn = 100011;
struct zz {
  int x;
  int id;
  bool operator<(const zz& cmp) const {
    if (x != cmp.x) {
      return x < cmp.x;
    } else {
      return id < cmp.id;
    }
  }
} zx;
int n;
zz a[maxn];
zz b[maxn];
map<zz, int> mp;
int pos;
int ans;
int pp[maxn * 2];
int ps[maxn * 2];
bool yes(int x) {
  while (x) {
    int temp = x % 10;
    if (temp != 7 && temp != 4) return false;
    x /= 10;
  }
  return true;
}
void sp(int x) {
  if (pos == x) return;
  ans++;
  pp[ans] = pos;
  ps[ans] = x;
  swap(mp[a[pos]], mp[a[x]]);
  swap(a[pos], a[x]);
  pos = x;
  return;
}
void start() {
  ans = 0;
  int temp;
  for (int i = 1; i <= n; i++) {
    sp(i);
    temp = mp[b[i]];
    sp(temp);
  }
  cout << ans << endl;
  for (int i = 1; i <= ans; i++) {
    cout << pp[i] << " " << ps[i] << endl;
  }
  return;
}
int main() {
  int idx = 0;
  while (cin >> n) {
    if (n == 1) {
      cout << "0" << endl;
      return 0;
    }
    int temp;
    bool ok = true;
    mp.clear();
    pos = -1;
    temp = -inf;
    for (int i = 1; i <= n; i++) {
      cin >> a[i].x;
      a[i].id = idx++;
      b[i] = a[i];
      if (a[i].x >= temp) {
        temp = a[i].x;
      } else {
        ok = false;
      }
      if (yes(a[i].x)) {
        pos = i;
      }
    }
    if (ok) {
      cout << "0" << endl;
      return 0;
    }
    if (pos == -1) {
      cout << "-1" << endl;
      return 0;
    }
    for (int i = 1; i <= n; i++) {
      mp[a[i]] = i;
    }
    sort(b + 1, b + n + 1);
    start();
  }
  return 0;
}
