#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, v[N], id[N], now[N], p[N];
bool is_lucky(int x) {
  while (x) {
    if (x % 10 != 7 && x % 10 != 4) return false;
    x /= 10;
  }
  return true;
}
void change(int pos1, int pos2) {
  swap(now[p[pos1]], now[p[pos2]]);
  swap(p[pos1], p[pos2]);
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", v + i), p[i] = id[i] = now[i] = i;
  if (is_sorted(v, v + n)) return printf("0\n"), 0;
  sort(id, id + n, [](int a, int b) { return v[a] < v[b]; });
  int c = -1;
  for (int i = 0; i < n; i++)
    if (is_lucky(v[i])) {
      c = i;
      break;
    }
  if (c == -1) return printf("-1\n"), 0;
  vector<pair<int, int>> ans;
  for (int i = 0; i < n; i++) {
    if (is_lucky(v[i])) {
      c = i;
      break;
    }
  }
  for (int i = 0; i < n; i++)
    if (p[i] != id[i]) {
      if (now[c] != i) {
        ans.emplace_back(now[c], i);
        change(now[c], i);
      }
      if (now[c] != now[id[i]]) {
        ans.emplace_back(now[c], now[id[i]]);
        change(now[c], now[id[i]]);
      }
    }
  printf("%d\n", (int)ans.size());
  for (auto x : ans) printf("%d %d\n", x.first + 1, x.second + 1);
}
