func_code_string: #include <bits/stdc++.h>   using namespace std;   const double PI = 2.0 * acos(0.0);   inline int getInt() {     int x;     scanf( %d , &x);     return x;   }   inline long long getLL() {     long long x;     scanf( %lld , &x);     return x;   };   inline int NUM(char c) { return (int)c - 48; }   inline char CHR(int n) { return (char)(n + 48); }   template <class T>   inline T MAX(T a, T b) {     if (a > b) return a;     return b;   }   template <class T>   inline T MIN(T a, T b) {     if (a < b) return a;     return b;   }   inline void OPEN(string s) {     freopen((s +  .in ).c_str(),  r , stdin);     freopen((s +  .out ).c_str(),  w , stdout);   }   int N;   int A[100000 + 5];   int sorted[100000 + 5];   map<int, stack<int> > MAP;   int pos[100000 + 5];   int idx = -1;   inline bool islucky(int x) {     if (x == 0) return false;     while (x) {       if (x % 10 != 4 && x % 10 != 7) return false;       x /= 10;     }     return true;   }   vector<pair<int, int> > sol;   stack<int> tumpuk;   bool found[100000 + 5];   inline int jelajah(int i) {     found[i] = true;     int root = i;     while (pos[i] != root) {       sol.push_back(make_pair(i, pos[i]));       i = pos[i];       found[i] = true;     }     return i;   }   int main() {     scanf( %d , &N);     for (int i = 0, _n = (N); i < _n; i++) {       scanf( %d , &A[i]);       if (islucky(A[i])) idx = i;       sorted[i] = A[i];     }     sort(sorted, sorted + N);     bool so = true;     for (int i = 0, _n = (N); i < _n; i++) {       if (A[i] != sorted[i]) {         so = false;       }     }     if (idx == -1 && !so) {       puts( -1 );       return 0;     } else if (idx == -1) {       puts( 0 );       return 0;     }     for (int i = (N)-1; i >= 0; i--) {       MAP[sorted[i]].push(i);     }     for (int i = 0, _n = (N); i < _n; i++) {       int x = A[i];       A[i] = MAP[x].top();       MAP[x].pop();       pos[A[i]] = i;     }     idx = jelajah(idx);     for (int i = 0, _n = (N); i < _n; i++) {       if (!found[i]) {         tumpuk.push(idx);         sol.push_back(make_pair(idx, i));         idx = jelajah(i);       }     }     while ((tumpuk).size() > 0) {       sol.push_back(make_pair(idx, tumpuk.top()));       idx = tumpuk.top();       tumpuk.pop();     }     printf( %d n , (sol).size());     for (int i = 0, _n = ((sol).size()); i < _n; i++) {       printf( %d %d n , sol[i].first + 1, sol[i].second + 1);     }     return 0;   }   