#include <bits/stdc++.h>
using namespace std;
template <class A, class B>
A convert(B x) {
  stringstream ss;
  ss << x;
  A ret;
  ss >> ret;
  return ret;
}
const int oo = ~0u >> 2;
const double eps = 1e-10;
const int mo = 100000007;
const int fx[8][2] = {{-1, 0},  {1, 0},  {0, -1}, {0, 1},
                      {-1, -1}, {-1, 1}, {1, -1}, {1, 1}};
vector<pair<int, int> > Ans, a;
vector<int> p, q;
int n;
bool chk(int x) {
  for (; x % 10 == 4 || x % 10 == 7; x /= 10)
    ;
  return !x;
}
void Ins(int x, int y) {
  if (x == y) return;
  Ans.push_back(make_pair(x, y));
  swap(q[x], q[y]);
  swap(p[q[x]], p[q[y]]);
}
int main() {
  while (scanf("%d", &n) != EOF) {
    a.clear();
    Ans.clear();
    int lucky(-1), x;
    for (int i = 0; i <= n - 1; ++i) {
      scanf("%d", &x);
      a.push_back(make_pair(x, i));
      if (chk(x)) lucky = i;
    }
    sort(a.begin(), a.end());
    bool sorted(1);
    p.resize(n);
    q.resize(n);
    for (int i = 0; i <= ((int)a.size()) - 1; ++i) {
      if (a[i].second != i) sorted = 0;
      p[i] = a[i].second, q[a[i].second] = i;
    }
    if (sorted) {
      printf("0\n");
      continue;
    }
    if (lucky == -1) {
      printf("-1\n");
      continue;
    }
    for (int i = 0; i <= n - 1; ++i)
      if (i != q[lucky]) Ins(lucky, i), lucky = p[i], Ins(i, lucky);
    printf("%d\n", ((int)Ans.size()));
    for (int i = 0; i <= ((int)Ans.size()) - 1; ++i)
      printf("%d %d\n", Ans[i].first + 1, Ans[i].second + 1);
  }
}
