#include <bits/stdc++.h>
using namespace std;
int a[100500];
int p[100500];
int q[100500];
vector<pair<int, int> > moves;
int n, h = -1;
bool asign(int x, int y) { return a[x] < a[y]; }
bool happy(int n) {
  if (n == 0) return true;
  if (n % 10 == 7 || n % 10 == 4) return happy(n / 10);
  return false;
}
void move(int x, int y) {
  if (x == y) return;
  moves.push_back(make_pair(x + 1, y + 1));
  swap(q[x], q[y]);
  p[q[x]] = x;
  p[q[y]] = y;
  if (h == x)
    h = y;
  else if (h == y)
    h = x;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
    p[i] = i;
    if (happy(a[i])) h = i;
  }
  sort(p, p + n, asign);
  if (h == -1) {
    for (int i = 0; i < n - 1; ++i)
      if (a[i] > a[i + 1]) {
        printf("-1\n");
        return 0;
      }
    printf("0\n");
    return 0;
  }
  for (int i = 0; i < n; ++i) q[p[i]] = i;
  for (int i = 0; i < n; ++i) {
    if (p[i] == h) continue;
    move(i, h);
    move(h, p[i]);
  }
  printf("%d\n", (int)moves.size());
  for (int i = 0; i < moves.size(); ++i)
    printf("%d %d\n", moves[i].first, moves[i].second);
  return 0;
}
