#include <bits/stdc++.h>
using namespace std;
map<pair<int, int>, int> need_pos;
map<pair<int, int>, int> curr_pos;
map<int, int> cnt;
const int MN = 1000 * 100 + 10;
pair<int, int> curr[MN], need[MN];
pair<int, int> st[MN];
pair<int, int> ans[2 * MN];
bool ok(int x) {
  while (x) {
    if (x % 10 != 7 && x % 10 != 4) return false;
    x /= 10;
  }
  return true;
}
int n, sz, pos = -1;
void myswap(int from, int to) {
  if (from == to) return;
  pair<int, int> tmp1 = curr[from];
  pair<int, int> tmp2 = curr[to];
  curr[to] = tmp1;
  curr[from] = tmp2;
  curr_pos[tmp2] = from;
  curr_pos[tmp1] = to;
  ans[sz++] = make_pair(from, to);
  if (ok(curr[to].first)) pos = to;
  if (ok(curr[from].first)) pos = from;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d", &need[i].first);
    need[i].second = cnt[need[i].first];
    cnt[need[i].first]++;
    curr[i] = need[i];
    curr_pos[curr[i]] = i;
    if (ok(curr[i].first)) pos = i;
    st[i] = curr[i];
  }
  sort(need, need + n);
  bool flag = true;
  for (int i = 0; i < n; i++) flag &= (need[i] == curr[i]);
  for (int i = 0; i < n; i++) {
    need_pos[need[i]] = i;
    flag |= ok(need[i].first);
  }
  if (!flag)
    cout << "-1";
  else {
    if (pos == -1)
      cout << "0\n";
    else {
      for (int i = 0; i < n; i++) {
        if (need_pos[curr[i]] == i) continue;
        if (ok(curr[i].first))
          myswap(i, curr_pos[need[i]]);
        else {
          myswap(i, pos);
          myswap(i, curr_pos[need[i]]);
        }
      }
      for (int i = 0; i < n; i++) {
        if (need_pos[curr[i]] == i) continue;
        if (ok(curr[i].first))
          myswap(i, curr_pos[need[i]]);
        else {
          myswap(i, pos);
          myswap(i, curr_pos[need[i]]);
        }
      }
      printf("%d\n", sz);
    }
    for (int i = 0; i < sz; i++)
      printf("%d %d\n", ans[i].first + 1, ans[i].second + 1);
  }
  return 0;
}
