#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
const long long INFLL = 1000000000000000000LL;
const int h = 100011;
bool lucky(int v) {
  while (v) {
    int r = v % 10;
    if (r != 4 && r != 7) return false;
    v /= 10;
  }
  return true;
}
int n, a[h], u[h], p[h];
vector<pair<int, int> > ans;
bool comp(int x, int y) { return a[x] < a[y]; }
void sw(int i, int j) {
  int ui = u[i], uj = u[j];
  swap(p[ui], p[uj]);
  swap(u[i], u[j]);
  ans.push_back(pair<int, int>(i, j));
}
int main() {
  scanf("%d", &n);
  for (int i(0), _b(n); i < _b; ++i) scanf("%d", a + i), p[i] = i;
  bool sorted = true;
  for (int i(0), _b(n - 1); i < _b; ++i)
    if (a[i] > a[i + 1]) {
      sorted = false;
      break;
    }
  if (sorted) {
    printf("0\n");
    return 0;
  }
  int x = 0;
  while (x < n && !lucky(a[x])) ++x;
  if (x == n) {
    printf("-1\n");
    return 0;
  }
  sort(p, p + n, comp);
  for (int i(0), _b(n); i < _b; ++i) u[p[i]] = i;
  for (int i(0), _b(n); i < _b; ++i)
    if (p[i] != x && p[i] != i) {
      if (i != x) sw(i, x);
      x = p[i];
      sw(i, p[i]);
    }
  printf("%d\n", int((ans).size()));
  for (int i(0), _b(int((ans).size())); i < _b; ++i)
    printf("%d %d\n", ans[i].first + 1, ans[i].second + 1);
  return 0;
}
