#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
const double PI = 3.141592653589793;
const int N = 100005;
int tab[N], n, kol[N], ind, d, i;
map<int, int> mapa;
vector<pair<int, int> > wek;
bool cmp(int a, int b) { return tab[a] < tab[b]; }
bool lucky(int a) {
  while (a > 0) {
    if (a % 10 != 4 && a % 10 != 7) return false;
    a /= 10;
  }
  return true;
}
void zamien(int a, int b) {
  if (a == b) return;
  int k1, k2;
  k1 = mapa[a];
  k2 = mapa[b];
  swap(tab[k1], tab[k2]);
  wek.push_back(pair<int, int>(k1, k2));
  mapa[a] = k2;
  mapa[b] = k1;
}
int main() {
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &tab[i]);
    kol[i] = i;
  }
  sort(kol, kol + n, cmp);
  d = 0;
  for (i = 1; i < n; i++)
    if (tab[i - 1] > tab[i]) d = 1;
  if (d == 0) {
    printf("0\n");
    return 0;
  }
  ind = -1;
  for (i = 0; i < n; i++)
    if (lucky(tab[i])) ind = i;
  if (ind == -1) {
    printf("-1\n");
    return 0;
  }
  for (i = 0; i < n; i++) {
    tab[kol[i]] = i;
    mapa[i] = kol[i];
  }
  ind = tab[ind];
  for (i = 0; i < n; i++) {
    zamien(ind, tab[i]);
    zamien(ind, i);
  }
  printf("%d\n", wek.size());
  for (i = 0; i < wek.size(); i++)
    printf("%d %d\n", wek[i].first + 1, wek[i].second + 1);
  return 0;
}
