#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n, tot, vis[N], bg[N], b[N], ok[N];
vector<pair<int, int> > ans;
struct node {
  int id, val, fl, mb;
} a[N << 1];
bool check(int x) {
  while (x > 0) {
    if (x % 10 != 4 && x % 10 != 7) return 0;
    x /= 10;
  }
  return 1;
}
bool cmp(int x, int y) { return a[x].val < a[y].val; }
void print(int x, int y) {
  if (x > y) swap(x, y);
  if (x != y) ans.push_back(make_pair(x, y));
}
void work(int x) {
  bg[++tot] = x;
  int nw = a[x].mb;
  vis[nw] = tot;
  while (nw != x) {
    nw = a[nw].mb;
    vis[nw] = tot;
  }
  return;
}
void solve(int bh, int k) {
  ok[bh] = 1;
  print(k, bg[bh]);
  int i = bg[bh];
  while (a[i].mb != bg[bh]) {
    print(i, a[i].mb);
    i = a[i].mb;
  }
  print(k, i);
}
int main() {
  scanf("%d", &n);
  bool flg = 1;
  int k = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i].val);
    a[i].id = i;
    b[i] = i;
    if (check(a[i].val)) {
      a[i].fl = 1;
      if (a[i].val < a[k].val || k == 0) k = a[i].id;
    }
    if (i > 1 && a[i - 1].val > a[i].val) flg = 0;
  }
  if (flg) {
    puts("0");
    return 0;
  }
  if (k == 0) {
    puts("-1");
    return 0;
  }
  sort(b + 1, b + n + 1, cmp);
  for (int i = 1; i <= n; i++) a[i].mb = b[i];
  for (int i = 1; i <= n; i++)
    if (!vis[i]) work(i);
  ok[vis[k]] = 1;
  int i = k;
  while (a[i].mb != k) {
    print(i, a[i].mb);
    i = a[i].mb;
  }
  k = i;
  for (int i = 1; i <= tot; i++)
    if (!ok[i]) solve(i, k);
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++)
    printf("%d %d\n", ans[i].first, ans[i].second);
  return 0;
}
