#include <bits/stdc++.h>
using namespace std;
bool is_lucky(int x) {
  while (x % 10 == 4 || x % 10 == 7) x /= 10;
  return (x == 0);
}
pair<int, int> nr[100010];
int p[100010];
vector<pair<int, int>> ans;
int main() {
  int n;
  cin >> n;
  for (int i(1); i <= n; i++) {
    cin >> nr[i].first;
    nr[i].second = i;
  }
  bool sorted(1);
  for (int i(1); i <= n; i++)
    if (nr[i].first < nr[i - 1].first) sorted = 0;
  if (sorted) {
    cout << 0;
    return 0;
  }
  sort(nr + 1, nr + n + 1);
  int id(-1);
  for (int i(1); i <= n; i++) {
    p[nr[i].second] = i;
    if (is_lucky(nr[i].first)) id = nr[i].second;
  }
  if (id == -1) {
    cout << -1;
    return 0;
  }
  set<int> de_modif;
  for (int i(1); i <= n; i++)
    if (i != id) de_modif.insert(i);
  while (!de_modif.empty()) {
    int i = *de_modif.begin();
    de_modif.erase(i);
    if (i == id || p[i] == i) continue;
    if (p[i] != id) {
      if (de_modif.find(p[i]) != de_modif.end()) {
        de_modif.erase(p[i]);
        de_modif.insert(id);
      }
      swap(p[p[i]], p[id]);
      ans.push_back({p[i], id});
      id = p[i];
    }
    swap(p[i], p[id]);
    ans.push_back({i, id});
    id = i;
  }
  cout << ans.size() << '\n';
  for (auto i : ans) cout << i.first << ' ' << i.second << '\n';
  return 0;
}
