#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<pair<int, int>> p(n);
  for (int i = 0; i < n; i++) {
    cin >> p[i].first;
    p[i].second = i;
  }
  sort(p.begin(), p.end());
  vector<int> go(n);
  for (int i = 0; i < n; i++) {
    go[p[i].second] = i;
  }
  int lucky = -1;
  for (int i = 0; i < n; i++) {
    int x = p[i].first;
    bool ok = x == 0 ? false : true;
    while (x > 0) {
      if (x % 10 != 4 && x % 10 != 7) ok = false;
      x /= 10;
    }
    if (ok) {
      lucky = p[i].second;
      break;
    }
  }
  if (lucky == -1) {
    int mx = 0;
    for (int i = 0; i < n; i++) {
      if (p[i].second < mx) {
        cout << -1;
        exit(0);
      }
      mx = max(mx, p[i].second);
    }
    cout << 0;
  } else {
    vector<pair<int, int>> ans;
    vector<int> cur(n), revcur(n);
    for (int i = 0; i < n; i++) {
      cur[i] = i;
      revcur[i] = i;
    }
    queue<int> q;
    for (int i = 0; i < n; i++)
      if (i != lucky) q.push(i);
    auto apply_swap = [&](int x, int y) {
      if (x != y) {
        ans.push_back(make_pair(cur[x], cur[y]));
      }
      swap(cur[x], cur[y]);
      revcur[cur[x]] = x;
      revcur[cur[y]] = y;
    };
    while (!q.empty()) {
      int original_pos = q.front();
      q.pop();
      apply_swap(lucky, revcur[go[original_pos]]);
      apply_swap(lucky, original_pos);
    }
    cout << (int)ans.size() << "\n";
    for (pair<int, int> p : ans) {
      cout << p.first + 1 << " " << p.second + 1 << "\n";
    }
  }
  return 0;
}
