#include <bits/stdc++.h>
using namespace std;
bool islucky(int n) {
  while (n) {
    if ((n % 10 != 4) && (n % 10 != 7)) return false;
    n /= 10;
  }
  return true;
}
pair<int, int> lucky;
vector<pair<int, int> > v, vs, res;
map<pair<int, int>, int> whereIt;
int main() {
  int n, lp = -1;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    if (islucky(t)) {
      lucky = make_pair(t, i);
      lp = i;
    }
    whereIt[make_pair(t, i)] = i;
    v.push_back(make_pair(t, i));
    vs.push_back(make_pair(t, i));
  }
  sort(vs.begin(), vs.end());
  if (lp == -1) {
    for (int i = 0; i < n; i++)
      if (v[i] != vs[i]) {
        cout << -1;
        return 0;
      }
  }
  for (int i = 0; i < n; i++) {
    pair<int, int> it = vs[i];
    int pos = whereIt[it];
    if (i != pos) {
      if (i != lp) {
        swap(v[i], v[lp]);
        whereIt[v[i]] = i;
        whereIt[v[lp]] = lp;
        res.push_back(make_pair(i, lp));
        lp = i;
      }
      if (pos != lp) {
        swap(v[i], v[pos]);
        whereIt[v[i]] = i;
        whereIt[v[pos]] = pos;
        res.push_back(make_pair(i, pos));
        lp = pos;
      }
    }
  }
  cout << res.size() << endl;
  for (int i = 0; i < res.size(); i++)
    cout << res[i].first + 1 << " " << res[i].second + 1 << endl;
exit:
  return (0);
}
