#include <bits/stdc++.h>
using namespace std;
int A[100010];
int B[100010];
int G[100010];
bool sf(int a, int b) {
  if (A[a] < A[b]) return true;
  if (A[a] > A[b]) return false;
  return a < b;
}
bool is_lucky(int i) {
  if (i == 0) return false;
  while (i > 0) {
    int x = i % 10;
    if (x != 4 && x != 7) return false;
    i /= 10;
  }
  return true;
}
bool done[100010];
int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) cin >> A[i], B[i] = i;
  sort(B, B + N, sf);
  for (int i = 0; i < N; i++) G[B[i]] = i;
  bool sorted = true;
  for (int i = 0; i < N; i++) {
    if (B[i] != i) sorted = false;
  }
  if (sorted) {
    cout << 0 << endl;
    return 0;
  }
  bool found = false;
  for (int i = 0; i < N; i++) {
    if (is_lucky(A[i])) found = true;
  }
  if (!found) {
    cout << -1 << endl;
    return 0;
  }
  vector<pair<int, int> > ans;
  for (int i = 0; i < N; i++) {
    if (done[i]) continue;
    if (!is_lucky(A[i])) continue;
    if (i == G[i]) continue;
    int j = i;
    while (j != G[i]) {
      done[j] = true;
      ans.push_back(make_pair(j, B[j]));
      swap(A[j], A[B[j]]);
      j = B[j];
    }
    done[j] = true;
  }
  int lc = -1;
  for (int i = 0; i < N; i++) {
    if (is_lucky(A[i])) lc = i;
  }
  assert(lc >= 0);
  for (int i = 0; i < N; i++) {
    if (done[i]) continue;
    if (is_lucky(A[i])) continue;
    if (i == G[i]) continue;
    ans.push_back(make_pair(lc, i));
    int j = i;
    while (j != G[i]) {
      done[j] = true;
      ans.push_back(make_pair(j, B[j]));
      swap(A[j], A[B[j]]);
      j = B[j];
    }
    done[j] = true;
    ans.push_back(make_pair(lc, j));
  }
  int X = ans.size();
  if (X > 2 * N) {
    cout << -1 << endl;
    return 0;
  }
  cout << X << endl;
  for (int i = 0; i < X; i++)
    cout << ans[i].first + 1 << " " << ans[i].second + 1 << endl;
}
