#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#pragma GCC target("avx2,tune=native")
using namespace std;
bool lucky(int x) {
  while (x > 0) {
    if (x % 10 != 7 && x % 10 != 4) return false;
    x /= 10;
  }
  return true;
}
vector<pair<int, int> > a, ans;
vector<int> cur;
void add_ans(int x, int y) {
  if (x == y) return;
  ans.emplace_back(x, y);
  swap(cur[x], cur[y]);
  a[cur[x]].second = x;
  a[cur[y]].second = y;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  a.resize(n);
  cur.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a.begin(), a.end());
  bool need = false;
  int x = -1;
  for (int i = 0; i < n; i++) {
    if (lucky(a[i].first)) x = i;
    need = need || a[i].second != i;
    cur[a[i].second] = i;
  }
  if (need && x == -1) {
    cout << "-1";
    return 0;
  } else if (x == -1) {
    cout << "0";
    return 0;
  }
  if (cur[x] + 1 != n) {
    if (x != a[x].second) add_ans(x, a[x].second);
    if (x != n - 1) add_ans(x, n - 1);
  }
  for (int i = 0; i < n; i++) {
    if (i == x || a[i].second == i) continue;
    add_ans(i, a[x].second);
    add_ans(a[i].second, a[x].second);
  }
  cout << ans.size() << "\n";
  for (pair<int, int> it : ans)
    cout << it.first + 1 << " " << it.second + 1 << "\n";
  return 0;
}
