#include <bits/stdc++.h>
using namespace std;
template <class T>
T abs(T x) {
  return x > 0 ? x : -x;
}
int n;
int m;
int x[100000];
int y[100000];
vector<pair<int, int> > res;
int cool(int x) {
  while (x) {
    if (x % 10 != 4 && x % 10 != 7) return 0;
    x /= 10;
  }
  return 1;
}
int main() {
  scanf("%d", &n);
  int ok = 1, luck = -1;
  for (int i = 0; i < n; i++) {
    scanf("%d", &x[i]);
    if (cool(x[i])) luck = i;
    if (i > 0 && x[i] < x[i - 1]) ok = 0;
  }
  if (ok)
    printf("0\n");
  else if (luck == -1)
    printf("-1\n");
  else {
    vector<pair<int, int> > v;
    for (int i = 0; i < n; i++) v.push_back(make_pair(x[i], i));
    sort((v).begin(), (v).end());
    for (int i = 0; i < n; i++) y[v[i].second] = i;
    for (int i = 0; i < n; i++) {
      if (v[i].second != i && v[i].second != luck) {
        if (luck != i) {
          int a = y[i];
          int b = y[luck];
          swap(v[a].second, v[b].second);
          swap(y[i], y[luck]);
          res.push_back(make_pair(i, luck));
          luck = i;
        }
        int j = v[i].second;
        int a = y[j];
        int b = y[luck];
        swap(v[a].second, v[b].second);
        swap(y[j], y[luck]);
        res.push_back(make_pair(j, luck));
        luck = j;
      }
    }
    printf("%d\n", ((int)(res).size()));
    for (int i = 0; i < ((int)(res).size()); i++)
      printf("%d %d\n", res[i].first + 1, res[i].second + 1);
  }
  return 0;
}
