#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void maxi(T &x, T y) {
  if (y > x) x = y;
}
template <class T>
inline void mini(T &x, T y) {
  if (y < x) x = y;
}
const int N = 2e5, B = 0x7fffffff;
pair<int, int> a[N];
int n;
int betler;
int minluk;
int shuna[N];
int ona[N];
vector<pair<int, int> > ans;
bool laki(int x) {
  if (x == 0) return 0;
  while (x) {
    if (x % 10 != 4 && x % 10 != 7) return 0;
    x /= 10;
  }
  return 1;
}
void degi(int x, int y) {
  if (x != y) {
    shuna[ona[x]] = y;
    shuna[ona[y]] = x;
    swap(ona[x], ona[y]);
    ans.push_back(make_pair(x, y));
  } else
    return;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i].first);
    betler += laki(a[i].first);
    a[i].second = i;
    if (laki(a[i].first)) minluk = i;
  }
  if (is_sorted(a + 1, a + n + 1)) return putchar('0'), !!0;
  if (betler == 0) return putchar('-'), putchar('1'), !!0;
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++) {
    shuna[i] = a[i].second;
    ona[a[i].second] = i;
  }
  for (int i = 1; i <= n; i++) {
    if (shuna[i] == i) continue;
    int t = shuna[i];
    degi(minluk, i);
    degi(i, t);
    minluk = t;
  }
  printf("%d\n", (int)ans.size());
  for (pair<int, int> res : ans) printf("%d %d\n", res.first, res.second);
  return !!0;
}
