#include <bits/stdc++.h>
using namespace std;
int n;
pair<int, int> a[100000], b[100000];
vector<pair<int, int> > ans;
bool islucky(int x) {
  do
    if (x % 10 != 4 && x % 10 != 7) return false;
  while (x /= 10);
  return true;
}
int getlucky() {
  for (int i = 0; i < n; i++)
    if (islucky(a[i].first)) return i;
  return -1;
}
void gao(int u, int v) {
  ans.push_back({u + 1, v + 1});
  swap(a[u], a[v]);
  swap(b[a[u].second].second, b[a[v].second].second);
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i].first);
    b[i].first = a[i].first;
    b[i].second = i;
  }
  if (is_sorted(a, a + n)) return puts("0");
  sort(b, b + n);
  for (int i = 0; i < n; i++) a[b[i].second].second = i;
  int x = getlucky();
  if (x < 0) return puts("-1");
  for (int k = 0; k <= 3; k++) {
    for (int i = 0; i < n; i++) {
      if (i == x) continue;
      if (b[i].second == i) continue;
      gao(x, i);
      x = i;
      if (x == b[i].second) continue;
      int t = b[i].second;
      gao(x, b[i].second);
      x = t;
    }
  }
  printf("%d\n", ans.size());
  for (auto c : ans) printf("%d %d\n", c.first, c.second);
}
