#include <bits/stdc++.h>
using namespace std;
int a[100500];
int perm[100500];
int now[100500];
int pos[100500];
vector<pair<int, int> > res;
int happy;
bool cmp(int x, int y) { return a[x] < a[y]; }
bool isHappy(int x) {
  while (x > 0) {
    if (x % 10 != 4 && x % 10 != 7) {
      return false;
    }
    x /= 10;
  }
  return true;
}
void Swap(int x) {
  if (x == happy) return;
  res.push_back(make_pair(x, happy));
  swap(pos[now[x]], pos[now[happy]]);
  swap(now[x], now[happy]);
  happy = x;
}
int c[100500];
int n;
void test() {
  for (int i = 0; i < n; i++) {
    c[i] = i;
  }
  for (int i = 0; i < res.size(); i++) {
    swap(c[res[i].first], c[res[i].second]);
  }
  for (int i = 0; i < n; i++) {
    if (c[i] != perm[i]) {
      throw 42;
    }
  }
}
int main() {
  scanf("%d", &n);
  happy = -1;
  int H;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    if (isHappy(a[i])) {
      H = happy = i;
    }
    perm[i] = i;
    now[i] = i;
    pos[i] = i;
  }
  bool sorted = true;
  for (int i = 0; i < n - 1; i++) {
    if (a[i] > a[i + 1]) {
      sorted = false;
      break;
    }
  }
  if (sorted) {
    printf("0\n");
    return 0;
  }
  if (happy == -1) {
    printf("-1\n");
    return 0;
  }
  sort(perm, perm + n, cmp);
  for (int i = 0; i < n; i++) {
    if (perm[i] == H) continue;
    if (now[i] == perm[i]) continue;
    Swap(i);
    Swap(pos[perm[i]]);
  }
  printf("%d\n", res.size());
  if (res.size() > 2 * n) {
    throw 42;
  }
  for (int i = 0; i < res.size(); i++) {
    printf("%d %d\n", res[i].first + 1, res[i].second + 1);
  }
  test();
  return 0;
}
