#include <bits/stdc++.h>
using namespace std;
bool il(int n) { return (n) ? il(n / 10) && (n % 10 == 4 || n % 10 == 7) : 1; }
int t[100001];
int f[100001];
int main() {
  int n;
  scanf("%d", &n);
  vector<pair<int, int> > a(n), r;
  int o = 1;
  int l = -1;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i].first);
    a[i].second = i;
    if (il(a[i].first)) l = i;
    if (i) o &= (a[i - 1] <= a[i]);
  }
  if (o) {
    puts("0");
    return 0;
  }
  if (l == -1) {
    puts("-1");
    return 0;
  }
  sort(a.begin(), a.end());
  for (int i = 0; i < a.size(); ++i) {
    t[a[i].second] = i;
    f[i] = a[i].second;
  }
  for (int i = 0; i < n; ++i) {
    if (f[i] == i) continue;
    if (f[i] == l) continue;
    int j = (i == l) ? f[i] : l;
    r.push_back(make_pair(i, j));
    swap(f[t[i]], f[t[j]]);
    swap(t[i], t[j]);
    l = (i == l) ? j : i;
    if (i == l) --i;
  }
  printf("%d\n", r.size());
  for (int i = 0; i < r.size(); ++i)
    printf("%d %d\n", r[i].first + 1, r[i].second + 1);
  return 0;
}
