#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
int check(int n) {
  while (n) {
    int t = n % 10;
    if (t != 4 && t != 7) return 0;
    n /= 10;
  }
  return 1;
}
int n, a[100005];
int b[100005];
int c[100005];
vector<pair<int, int> > ans;
bool cmp(int i, int j) { return a[i] < a[j]; }
void slove(int &x, int y) {
  if (x == y) return;
  if (!check(a[x]) && !check(a[y])) puts("error");
  swap(a[x], a[y]);
  ans.push_back(make_pair(x, y));
  swap(c[x], c[y]);
  b[c[x]] = x;
  b[c[y]] = y;
  x = y;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i], b[i] = i;
  sort(b + 1, b + 1 + n, cmp);
  int pos = -1;
  for (int i = 1; i <= n; i++) c[b[i]] = i;
  for (int i = 1; i <= n; i++)
    if (check(a[i])) {
      pos = i;
      break;
    }
  if (pos == -1) {
    int flag = 1;
    for (int i = 1; i < n; i++)
      if (a[i] > a[i + 1]) flag = 0;
    puts(flag ? "0" : "-1");
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    {
      slove(pos, i);
      slove(pos, b[i]);
    }
  }
  slove(pos, b[pos]);
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++)
    cout << ans[i].first << " " << ans[i].second << endl;
  return 0;
}
