#include <bits/stdc++.h>
using namespace std;
int n;
int values[100005];
int current[100005];
int goal[100005];
int where[100005];
vector<pair<int, int> > moves;
bool is_lucky(int x) {
  while (x > 0) {
    if (x % 10 != 4 && x % 10 != 7) return false;
    x /= 10;
  }
  return true;
}
bool index_compare(int i, int j) { return values[i] < values[j]; }
void swap_indices(int i, int j) {
  if (i == j) return;
  moves.push_back(pair<int, int>(i + 1, j + 1));
  swap(current[i], current[j]);
  where[current[i]] = i;
  where[current[j]] = j;
}
int main() {
  scanf("%d", &n);
  int lucky = -1;
  for (int i = 0; i < n; i++) {
    scanf("%d", &values[i]);
    if (is_lucky(values[i])) lucky = i;
  }
  bool is_sorted = true;
  for (int i = 0; i < n - 1; i++)
    if (values[i + 1] < values[i]) is_sorted = false;
  if (is_sorted) {
    printf("0\n");
    return 0;
  }
  if (lucky == -1) {
    printf("-1\n");
    return 0;
  }
  for (int i = 0; i < n; i++) {
    goal[i] = i;
    current[i] = i;
    where[i] = i;
  }
  sort(goal, goal + n, index_compare);
  for (int i = 0; i < n; i++) {
    if (current[i] == goal[i]) continue;
    swap_indices(i, lucky);
    lucky = i;
    int j = where[goal[i]];
    swap_indices(j, lucky);
    lucky = j;
  }
  for (int i = 0; i < n; i++) assert(current[i] == goal[i]);
  assert((int)moves.size() <= 2 * n);
  printf("%d\n", (int)moves.size());
  for (int i = 0; i < (int)moves.size(); i++)
    printf("%d %d\n", moves[i].first, moves[i].second);
}
