#include <bits/stdc++.h>
using namespace std;
string tostring(long long n) {
  ostringstream ss;
  ss << n;
  return ss.str();
}
long long tonumber(string str) {
  stringstream ss;
  ss << str;
  long long n;
  ss >> n;
  return n;
}
bool lucky(int num) {
  while (num) {
    if (num % 10 != 7 && num % 10 != 4) return false;
    num /= 10;
  }
  return true;
}
int main() {
  int n, val;
  while (cin >> n) {
    vector<pair<int, int> > arr, vec, result;
    for (int i = 0; i < n; i++) {
      cin >> val;
      arr.push_back(make_pair(val, 0));
      vec.push_back(make_pair(val, i));
    }
    sort(vec.begin(), vec.end());
    bool ok = true;
    for (int i = 0; i < n; i++) {
      if (vec[i].first != arr[i].first) {
        ok = false;
        break;
      }
    }
    if (ok) {
      cout << "0\n";
      continue;
    }
    ok = false;
    int k;
    for (int i = 0; i < n; i++) {
      if (lucky(arr[i].first)) {
        ok = true;
        k = i;
        break;
      }
    }
    if (!ok) {
      cout << "-1\n";
      continue;
    }
    for (int i = 0; i < n; i++) {
      arr[vec[i].second].second = i;
    }
    k = arr[k].second;
    result.clear();
    for (int i = 0; i < n; i++) {
      if (vec[i].first == arr[i].first && vec[i].second == arr[i].second)
        continue;
      if (vec[k].second != i)
        result.push_back(make_pair(vec[k].second + 1, i + 1));
      swap(arr[i], arr[vec[k].second]);
      vec[arr[vec[k].second].second].second = vec[k].second;
      vec[k].second = i;
      if (i != vec[i].second)
        result.push_back(make_pair(i + 1, vec[i].second + 1));
      swap(arr[i], arr[vec[i].second]);
      vec[k].second = vec[i].second;
      vec[i].second = i;
    }
    cout << result.size() << endl;
    for (int i = 0; i < result.size(); i++) {
      cout << result[i].first << " " << result[i].second << endl;
    }
  }
}
