#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > v, vs;
map<pair<int, int>, int> afla;
bool is_lucky(int x) {
  if (x == 0) return false;
  while (x) {
    if (x % 10 == 4 || x % 10 == 7)
      ;
    else
      return false;
    x /= 10;
  }
  return true;
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    v.push_back(make_pair(x, i));
    afla[make_pair(x, i)] = i;
    vs.push_back(make_pair(x, i));
  }
  sort(vs.begin(), vs.end());
  pair<int, int> xx;
  xx.first = -1;
  for (int i = 0; i < v.size(); ++i)
    if (is_lucky(v[i].first)) {
      xx.first = v[i].first;
      xx.second = v[i].second;
    }
  int ok = 0;
  for (int i = 0; i < vs.size(); ++i)
    if (afla[vs[i]] != i) ok = 1;
  if (ok == 0) {
    cout << "0\n";
    return 0;
  }
  if (xx.first == -1) {
    cout << "-1\n";
    return 0;
  }
  vector<pair<int, int> > sol;
  for (int i = 0; i < v.size(); ++i) {
    if (vs[i].first == xx.first && vs[i].second == xx.second) continue;
    if (afla[vs[i]] == i) continue;
    int p1 = afla[xx], p2 = i;
    if (p1 != p2) sol.push_back(make_pair(p1, p2));
    afla[v[i]] = afla[xx];
    afla[xx] = i;
    swap(v[p1], v[p2]);
    p1 = afla[vs[i]], p2 = i;
    if (p1 != p2) sol.push_back(make_pair(p1, p2));
    afla[v[i]] = afla[vs[i]];
    afla[vs[i]] = i;
    swap(v[p1], v[p2]);
  }
  cout << sol.size() << '\n';
  for (int i = 0; i < sol.size(); ++i)
    cout << sol[i].first + 1 << ' ' << sol[i].second + 1 << '\n';
  return 0;
}
