#include <bits/stdc++.h>   using namespace std;   using ll = long long;   int n, a[100005], sta[100005];   vector<int> V;   int calc(int k) {     while (k) {       int d = k % 10;       k /= 10;       if (d != 4 && d != 7) return 0;     }     return 1;   }   using pii = pair<int, int>;   int tar[100005], to[100005];   vector<pii> Ans;   void Swap(int first, int second) {     if (first == second) return;     to[tar[first]] = second, to[tar[second]] = first;     swap(tar[second], tar[first]);     Ans.push_back(pii(first, second));     return;   }   int main() {     V.resize(1100800);     for (auto first : V) first = rand();     scanf( %d , &n);     int g = 0, pos = -1;     vector<pii> vec;     for (int i = 1; i <= n; i++) {       scanf( %d , &a[i]);       sta[i] = calc(a[i]);       g += sta[i];       if (sta[i]) pos = i;       vec.push_back(pii(a[i], i));     }     sort(vec.begin(), vec.end());     for (int i = 0; i < vec.size(); i++) {       tar[vec[i].second] = i + 1;       to[i + 1] = vec[i].second;     }     if (g == 0) {       bool flag = 0;       for (int i = 1; i < n; i++)         if (a[i] > a[i + 1]) flag = 1;       if (flag)         puts( -1 );       else         puts( 0 );     } else {       assert(pos > 0);       for (int i = 1; i <= n; i++) {         Swap(pos, i);         pos = i;         int prv = to[i];         Swap(pos, to[i]);         pos = prv;       }       int sz = Ans.size();       printf( %d n , sz);       for (auto first : Ans) {         printf( %d %d n , first.first, first.second);       }     }     return 0;   }   