#include <bits/stdc++.h>
using namespace std;
bool luck(int& x) {
  int t;
  do {
    t = x % 10;
    if (t != 4 && t != 7) return false;
  } while (x /= 10);
  return true;
}
vector<pair<int, int> > p, a;
void swp(int x, int y) {
  if (x != y) {
    swap(p[x].first, p[y].first);
    p[p[x].first].second = x;
    p[p[y].first].second = y;
    a.push_back(make_pair(x, y));
  }
}
int t, z = -1, n, i;
int main() {
  scanf("%d", &n);
  for (i = 0; i < n; ++i) {
    scanf("%d", &t);
    p.push_back(make_pair(t, i));
    if (z == -1)
      if (luck(t)) z = i;
  }
  sort(p.begin(), p.end());
  for (i = 0; i < n; ++i) p[p[i].second].first = i;
  for (i = 0; i < n; ++i) p[p[i].first].second = i;
  for (i = 0; i < n && p[i].first == i; ++i)
    ;
  if (i == n) return puts("0");
  if (i < n && (z == -1)) return puts("-1");
  for (; i < n; ++i)
    if (p[i].first != i) {
      t = p[i].second;
      swp(z, i);
      swp(i, t);
      z = t;
    }
  printf("%d\n", a.size());
  for (i = 0; i < a.size(); ++i)
    printf("%d %d\n", a[i].first + 1, a[i].second + 1);
  return 0;
}
