#[allow(unused_macros)]
macro_rules! input {
    ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } };
    ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } };
}
#[allow(unused_macros)]
macro_rules! input_inner {
    ( $ next : expr ) => { };
    ( $ next : expr , ) => { };
    ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } };
}
#[allow(unused_macros)]
macro_rules! read_value {
    ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) };
    ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) };
    ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) };
    ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 };
    ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) };
}

fn main() {
    input! {
        n: usize,
        a_: [i64; n]
    }

    let mut a = a_.clone();
    let mut ret = vec![];

    if !a.iter().all(|&x| x >= 0) && !a.iter().all(|&x| x <= 0) {
        let (max_index, max) = max_with_index(&a_);
        let (min_index, min) = min_with_index(&a_);
        if max.abs() > min.abs() {
            for i in 0..n {
                if a[i] < 0 {
                    a[i] += a[max_index];
                    ret.push((max_index, i));
                }
            }
        } else {
            for i in 0..n {
                if a[i] > 0 {
                    a[i] += a[min_index];
                    ret.push((min_index, i));
                }
            }
        }
    }

    if a.iter().all(|&x| x >= 0) {
        for i in 0..n-1 {
            ret.push((i, i + 1));
        }
    } else {
        for i in 0..n-1 {
            ret.push((n-i-1, n-i-2));
        }
    }

    println!("{}", ret.len());
    for i in 0..ret.len() {
        println!("{} {}", ret[i].0+1, ret[i].1+1);
    }
}

#[doc = " slice.len() >= 1"]
#[allow(dead_code)]
fn max_with_index<T: Ord>(slice: &[T]) -> (usize, &T) {
    let mut value: Option<&T> = None;
    let mut index = 0;
    for i in 0..slice.len() {
        if let Some(v) = value {
            if v < &slice[i] {
                index = i;
                value = Some(&slice[i]);
            }
        } else {
            index = i;
            value = Some(&slice[i]);
        }
    }
    (index, value.expect("not found max value"))
}

#[doc = " slice.len() >= 1"]
#[allow(dead_code)]
fn min_with_index<T: Ord>(slice: &[T]) -> (usize, &T) {
    let mut value: Option<&T> = None;
    let mut index = 0;
    for i in 0..slice.len() {
        if let Some(v) = value {
            if v > &slice[i] {
                index = i;
                value = Some(&slice[i]);
            }
        } else {
            index = i;
            value = Some(&slice[i]);
        }
    }
    (index, value.expect("not found min value"))
}

Measured memory_bytes: 4352