#include <bits/stdc++.h>
using namespace std;
bool lucky(int x) {
  while (x > 0) {
    if (x % 10 != 4 && x % 10 != 7) return false;
    x /= 10;
  }
  return true;
}
struct element {
  int v, ind, sort_ind;
  element() {}
  element(int a, int b) {
    v = a;
    ind = b;
  }
};
bool operator<(const element& x, const element& y) { return x.v < y.v; }
vector<element> a, s;
vector<pair<int, int> > ans;
void sw(int i, int j) {
  if (i == j) return;
  ans.push_back(make_pair(i + 1, j + 1));
  int it1 = a[i].sort_ind, it2 = a[j].sort_ind;
  swap(s[it1].ind, s[it2].ind);
  swap(a[i].v, a[j].v);
  swap(a[i].sort_ind, a[j].sort_ind);
}
int main() {
  int n, t;
  scanf("%d", &n);
  for (int(i) = 0; (i) < (int)(n); (i)++) {
    scanf("%d", &t);
    a.push_back(element(t, i));
  }
  s = a;
  sort(s.begin(), s.end());
  for (int(i) = 0; (i) < (int)(n); (i)++) a[s[i].ind].sort_ind = i;
  bool is = true;
  for (int(i) = 0; (i) < (int)(n); (i)++) {
    if (s[i].v != a[i].v) {
      is = false;
      break;
    }
  }
  if (is) {
    printf("0");
    return 0;
  }
  element m(0, -1);
  for (int(i) = 0; (i) < (int)(n); (i)++) {
    if (lucky(a[i].v)) {
      m = a[i];
      break;
    }
  }
  if (m.ind == -1) {
    printf("-1");
    return 0;
  }
  int r = 0, k = 0;
  for (int(i) = 0; (i) < (int)(n); (i)++) {
    if (i == m.sort_ind || s[i].ind == i) continue;
    if (i == m.ind) {
      int t = s[i].ind;
      sw(s[i].ind, m.ind);
      m.ind = t;
    } else {
      int t = i;
      sw(i, m.ind);
      m.ind = i;
      t = s[i].ind;
      sw(s[i].ind, m.ind);
      m.ind = t;
    }
  }
  printf("%d\n", ans.size());
  for (int(i) = 0; (i) < (int)(ans.size()); (i)++) {
    printf("%d %d\n", ans[i].first, ans[i].second);
  }
  return 0;
}
