#include <bits/stdc++.h>
const int inf = (1ll << 30) - 1;
const int maxn = (int)1e5 + 10;
using namespace std;
pair<int, int> a[100100];
int p[100100];
int b[100100];
int n;
void Swap(int x, int y) {
  swap(b[x], b[y]);
  p[b[x]] = x;
  p[b[y]] = y;
}
void solve() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i].first);
    a[i].second = i;
  }
  int ok = 1;
  for (int i = 1; i < n; i++) {
    ok &= (a[i].first >= a[i - 1].first);
  }
  if (ok) {
    printf("0\n");
    return;
  }
  sort(a, a + n);
  int l = -1;
  for (int i = 0; i < n; i++) {
    b[a[i].second] = i;
    int o = 1;
    int d = a[i].first;
    while (d > 0) {
      if (d % 10 != 4 && d % 10 != 7) o = 0;
      d /= 10;
    }
    if (o) {
      l = i;
    }
  }
  if (l == -1) {
    printf("-1\n");
    return;
  }
  vector<pair<int, int> > ans;
  for (int i = 0; i < n; i++) {
    p[b[i]] = i;
  }
  for (int i = 0; i < n; i++) {
    if (b[i] != i) {
      if (i == l) continue;
      if (p[l] != i) {
        ans.push_back(make_pair(p[l], i));
        Swap(p[l], i);
      }
      if (p[i] != p[l]) {
        ans.push_back(make_pair(p[l], p[i]));
        Swap(p[l], p[i]);
      }
    }
  }
  printf("%d\n", ans.size());
  for (__typeof(ans.begin()) it = ans.begin(); it != ans.end(); it++) {
    printf("%d %d\n", it->first + 1, it->second + 1);
  }
}
int main() {
  int t = 1;
  for (int i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}
