#include <bits/stdc++.h>
using namespace std;
bool lucky(int x) {
  while (x) {
    if (x % 10 != 4 && x % 10 != 7) return false;
    x /= 10;
  }
  return true;
}
vector<int> v, perm, rev;
int Lindv = -1;
inline int Lindreal() { return perm[Lindv]; }
void swapreal(int i1, int i2) {
  int iv1 = rev[i1], iv2 = rev[i2];
  perm[iv1] = i2;
  perm[iv2] = i1;
  rev[i1] = iv2;
  rev[i2] = iv1;
}
int main() {
  int n;
  scanf("%d", &n);
  v.resize(n);
  perm.resize(n);
  rev.resize(n);
  priority_queue<pair<int, int> > S;
  for (int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    v[i] = a;
    perm[i] = i;
    rev[i] = i;
    S.push(pair<int, int>(-a, i));
    if (Lindv == -1 && lucky(a)) Lindv = i;
  }
  if (Lindv == -1) {
    bool sorted = true;
    for (int i = 1; i < n; i++)
      if (v[i - 1] > v[i]) sorted = false;
    if (sorted)
      printf("0\n");
    else
      printf("-1\n");
    return 0;
  }
  vector<pair<int, int> > swaps;
  int Lrealshould = -1;
  for (int k = 0; k < n - 1; k++) {
    int minindv = S.top().second;
    S.pop();
    int minindreal = perm[minindv];
    ;
    if (minindreal != Lindreal()) {
      if (minindreal == k) continue;
      if (Lindreal() != k) {
        swaps.push_back(pair<int, int>(k, Lindreal()));
        swapreal(k, Lindreal());
      }
      swaps.push_back(pair<int, int>(minindreal, Lindreal()));
      swapreal(minindreal, Lindreal());
    } else {
      Lrealshould = k;
      continue;
    }
  }
  if (Lrealshould != -1 && Lindreal() != Lrealshould)
    swaps.push_back(pair<int, int>(Lrealshould, n - 1));
  printf("%d\n", swaps.size());
  for (int i = 0; i < swaps.size(); i++)
    printf("%d %d\n", swaps[i].first + 1, swaps[i].second + 1);
  return 0;
}
