#include <bits/stdc++.h>
using namespace std;
int n;
int a[100000], b[100000], c[100000], pos[100000], x[200000], y[200000];
void swap(int *x, int *y) {
  int tmp = *x;
  *x = *y;
  *y = tmp;
}
void quicksort(int l, int r) {
  if (l >= r) return;
  int i = l, j = r, t = a[(l + r) / 2];
  while (i < j) {
    while (a[i] < t) i++;
    while (a[j] > t) j--;
    if (i <= j) {
      swap(&a[i], &a[j]);
      swap(&b[i], &b[j]);
      i++;
      j--;
    }
  }
  quicksort(l, j);
  quicksort(i, r);
}
bool InOrder() {
  for (int i = 1; i < n; i++)
    if (a[i] < a[i - 1]) return false;
  return true;
}
bool Lucky(int x) {
  while (x) {
    if (x % 10 != 4 && x % 10 != 7) return false;
    x /= 10;
  }
  return true;
}
int main() {
  int i, p = 0;
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%d", &a[i]);
  while (p < n && !Lucky(a[p])) p++;
  bool flag = InOrder();
  for (i = 0; i < n; i++) b[i] = i;
  quicksort(0, n - 1);
  for (i = 0; i < n; i++) {
    c[i] = i;
    pos[i] = i;
  }
  if (p == n)
    if (flag)
      printf("0\n");
    else
      printf("-1\n");
  else {
    int Total = 0;
    for (i = 0; i < n; i++) {
      if (p != i) {
        x[Total] = p;
        y[Total] = i;
        swap(&c[p], &c[i]);
        pos[c[p]] = p;
        pos[c[i]] = i;
        p = i;
        Total++;
      }
      if (p != pos[b[i]]) {
        x[Total] = p;
        y[Total] = pos[b[i]];
        swap(&c[x[Total]], &c[y[Total]]);
        pos[c[x[Total]]] = x[Total];
        pos[c[y[Total]]] = y[Total];
        p = y[Total];
        Total++;
      }
    }
    printf("%d\n", Total);
    for (i = 0; i < Total; i++) printf("%d %d\n", x[i] + 1, y[i] + 1);
  }
  return 0;
}
