#include <bits/stdc++.h>
using namespace std;
struct arr {
  long v;
  long c;
};
vector<struct arr> a;
vector<long> pos, vtri;
bool ascend(struct arr x, struct arr y) { return x.v < y.v; }
bool lucky(long n) {
  while (n != 0) {
    if ((n % 10 != 4) && (n % 10 != 7)) return false;
    n = n / 10;
  }
  return true;
}
void swap(long a, long b, long c, long d) {
  long t;
  t = vtri[a];
  vtri[a] = vtri[b];
  vtri[b] = t;
  t = pos[c];
  pos[c] = pos[d];
  pos[d] = t;
}
int main() {
  long n;
  scanf("%ld", &n);
  a.resize(n);
  for (long i = 0; i <= n - 1; i++) {
    scanf("%ld", &a[i].v);
    a[i].c = i;
  }
  long res = 0;
  for (long i = 0; i <= n - 2; i++)
    if (a[i].v > a[i + 1].v) res = 1;
  if (res == 0) {
    cout << 0;
    return 0;
  }
  sort(a.begin(), a.end(), ascend);
  res = 0;
  long rr = 0;
  long pp, p;
  for (long i = 0; i <= n - 1; i++)
    if (lucky(a[i].v)) {
      res = 1;
      p = a[i].c;
      break;
    }
  if (res == 0) {
    cout << -1;
    return 0;
  }
  res = 0;
  pos.resize(n);
  vtri.resize(n);
  for (long i = 0; i <= n - 1; i++) {
    pos[i] = a[i].c;
    vtri[a[i].c] = i;
  }
  pp = p;
  for (long i = 0; i <= n - 1; i++)
    if (i != vtri[pp]) {
      long j = pos[i];
      if (pp == i) {
        res++;
        swap(pp, j, vtri[pp], i);
        pp = j;
      } else if ((i != j) && (i != pp)) {
        res += 2;
        swap(pp, i, vtri[pp], vtri[i]);
        pp = i;
        swap(pp, j, vtri[pp], vtri[j]);
        pp = j;
      }
    }
  cout << res << endl;
  for (long i = 0; i <= n - 1; i++) {
    pos[i] = a[i].c;
    vtri[a[i].c] = i;
  }
  pp = p;
  for (long i = 0; i <= n - 1; i++)
    if (i != vtri[pp]) {
      long j = pos[i];
      if (pp == i) {
        res++;
        printf("%ld %ld\n", pp + 1, j + 1);
        swap(pp, j, vtri[pp], i);
        pp = j;
      } else if ((i != j) && (i != pp)) {
        res += 2;
        printf("%ld %ld\n", pp + 1, i + 1);
        swap(pp, i, vtri[pp], vtri[i]);
        pp = i;
        printf("%ld %ld\n", pp + 1, j + 1);
        swap(pp, j, vtri[pp], vtri[j]);
        pp = j;
      }
    }
  return 0;
}
