#include using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; vector A(N); for(auto &a : A) cin >> a; if(N == 2){ long long answer = (A.at(0)-1)*(A.at(1)-1); if(answer%2 || answer < 0) answer = 0; cout << answer << endl; cout << "1 2" << endl; } else if(N == 3){ if(A.at(0) <= 1 || A.at(1) <= 1 || A.at(2) <= 1){ cout << 0 << endl << "1 2" << endl << "1 2" << endl; } else if(A.at(0)%2 == 0 || A.at(1)%2 == 0 || A.at(2)%2 == 0){ cout << 0 << endl; if(A.at(0)%2 == 0) cout << "2 3" << endl; else if(A.at(1)%2 == 0) cout << "1 3" << endl; else cout << "1 2" << endl; cout << "1 2" << endl; } else{ long long ans = 1,left = max_element(A.begin(),A.end())-A.begin(); for(int i=0; i<3; i++){ if(i == left) continue; ans *= A.at(i)-1; } ans = (ans-1)*(A.at(left)-1); cout << ans << endl; bool output = false; for(int i=0; i<3; i++){ if(left == i) continue; if(output) cout << " "; output = true; cout << i+1; } cout << endl << "1 2" << endl; } } else{ cout << 0 << endl; cout << "1 2" << endl << "1 2" << endl; cout << N-3 << " " << N-2 << endl; N -= 3; while(N != 1){ cout << 1 << " " << N << endl; N--; } } }