#include <bits/stdc++.h>
using namespace std;
int v[100100];
pair<int, int> vor[100100];
int onde[100100];
int pivo = -1;
bool ta = true;
pair<int, int> resp[2 * 100100];
int nresp = 0;
bool lucky(int a) {
  while (a) {
    int x = a % 10;
    if (x == 4 || x == 7)
      a /= 10;
    else
      return false;
  }
  return true;
}
void tr(int a, int b) {
  if (a != b) {
    onde[v[b]] = a;
    onde[v[a]] = b;
    swap(v[a], v[b]);
    resp[nresp++] = pair<int, int>(a, b);
  }
  if (pivo == a)
    pivo = b;
  else if (pivo == b)
    pivo = a;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &v[i]);
    if (lucky(v[i])) {
      pivo = i;
    }
    if (i && v[i] < v[i - 1]) ta = false;
    vor[i] = pair<int, int>(v[i], i);
  }
  if (ta)
    printf("0\n");
  else if (pivo == -1) {
    printf("-1\n");
  } else {
    sort(vor, vor + n);
    for (int i = 0; i < n; ++i) {
      v[vor[i].second] = i;
    }
    for (int i = 0; i < n; ++i) {
      onde[v[i]] = i;
    }
    for (int i = 0; i < n; ++i) {
      tr(pivo, i);
      tr(i, onde[i]);
    }
    printf("%d\n", nresp);
    for (int i = 0; i < nresp; ++i)
      printf("%d %d\n", resp[i].first + 1, resp[i].second + 1);
  }
  return 0;
}
