#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
const int mod = inf + 7;
const double eps = 1e-9;
const double pi = acos(-1.0);
int n, ind = -1;
int a[100100], b[100100];
pair<int, int> c[100100];
int v[100100], pos[100100];
vector<pair<int, int> > ans;
bool is_happy(int x) {
  if (x == 0) return true;
  int c = x % 10;
  if (c != 4 && c != 7) return false;
  return is_happy(x / 10);
}
void sw(int x, int y) {
  if (x == y) return;
  ans.push_back(make_pair(x, y));
  swap(a[x], a[y]);
  pos[a[x]] = x;
  pos[a[y]] = y;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d", a + i);
    b[i] = a[i];
    c[i] = make_pair(a[i], i);
    if (is_happy(a[i])) ind = i;
  }
  sort(b, b + n);
  bool ok = 1;
  for (int i = 0; i < n; i++) ok &= (a[i] == b[i]);
  if (ok) {
    printf("0\n");
    return 0;
  }
  if (ind == -1) {
    if (ok)
      printf("0\n");
    else
      printf("-1\n");
    return 0;
  }
  sort(c, c + n);
  for (int i = 0; i < n; i++) a[c[i].second] = i;
  for (int i = 0; i < n; i++) pos[a[i]] = i;
  int x = a[ind];
  for (int i = 0; i < n; i++) {
    if (i == x) continue;
    if (a[i] == i) continue;
    int target = pos[i];
    sw(ind, i);
    ind = i;
    sw(ind, target);
    ind = target;
  }
  printf("%d\n", (int)ans.size());
  for (__typeof(ans.begin()) it = ans.begin(); it != ans.end(); it++) {
    printf("%d %d\n", it->first + 1, it->second + 1);
  }
  return 0;
}
