#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > a;
vector<pair<int, int> > res;
int pos[111111];
int rpos[111111];
vector<bool> c;
int n;
bool good(int x) {
  while (x != 0) {
    int d = x % 10;
    if (d != 4 && d != 7) return false;
    x /= 10;
  }
  return true;
}
void fix(int from, int to) {
  if (rpos[to] == rpos[from]) return;
  res.push_back(make_pair(rpos[to], rpos[from]));
  swap(pos[rpos[to]], pos[rpos[from]]);
  swap(rpos[from], rpos[to]);
}
void change(int ind, int luck) {
  int from = a[ind].second;
  int to = pos[ind];
  if (from == to) return;
  if (c[from] || c[to]) {
    fix(from, to);
  } else {
    fix(to, luck);
    fix(luck, from);
  }
}
int main() {
  cin >> n;
  bool ans = false;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    bool g = good(x);
    a.push_back(make_pair(x, i));
    c.push_back(g);
    ans |= g;
  }
  sort(a.begin(), a.end());
  if (!ans) {
    for (int i = 0; i < n; i++) {
      if (a[i].second != i) {
        cout << -1;
        return 0;
      }
    }
    cout << 0 << endl;
    return 0;
  }
  int ind = 0;
  for (int i = 0; i < n; i++) {
    if (c[i]) ind = i;
  }
  for (int i = 0; i < n; i++) {
    pos[i] = i;
  }
  for (int i = 0; i < n; i++) {
    rpos[i] = i;
  }
  for (int i = 0; i < n; i++) {
    change(i, ind);
  }
  cout << res.size() << endl;
  for (int i = 0; i < res.size(); i++) {
    cout << res[i].first + 1 << ' ' << res[i].second + 1 << endl;
  }
}
