public static void main ( String [ ] args ) {
  FastReader in = new FastReader ( ) ;
  int i , j , k , n , a , b = 0 , c = 0 , a1 , b1 = 0 , c1 = 0 , a_count , b_count ;
  boolean is = false , is1 = false ;
  n = in . nextInt ( ) ;
  int [ ] arr = new int [ n ] ;
  for ( i = 0 ;
  i < n ;
  i ++ ) arr [ i ] = in . nextInt ( ) ;
  if ( n == 1 || n == 2 ) {
    System . out . println ( - 1 ) ;
    return ;
  }
  a = arr [ 0 ] ;
  a1 = 1 ;
  a_count = 1 ;
  b_count = 0 ;
  for ( i = 1 ;
  i < n ;
  i ++ ) {
    if ( a == arr [ i ] ) a_count ++ ;
    else if ( ! is ) {
      b = arr [ i ] ;
      b_count ++ ;
      b1 = i + 1 ;
      is = true ;
    }
    else if ( b == arr [ i ] ) b_count ++ ;
    else if ( ! is1 ) {
      c = arr [ i ] ;
      c1 = i + 1 ;
      is1 = true ;
    }
  };
}

public static void main ( String [ ] args ) { FastReader in = new FastReader ( ) ; int i , j , k , n , a , b = 0 , c = 0 , a1 , b1 = 0 , c1 = 0 , a_count , b_count ; boolean is = false , is1 = false ; n = in . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( i = 0 ; i < n ; i ++ ) arr [ i ] = in . nextInt ( ) ; if ( n == 1 || n == 2 ) { System . out . println ( - 1 ) ; return ; } a = arr [ 0 ] ; a1 = 1 ; a_count = 1 ; b_count = 0 ; for ( i = 1 ; i < n ; i ++ ) { if ( a == arr [ i ] ) a_count ++ ; else if ( ! is ) { b = arr [ i ] ; b_count ++ ; b1 = i + 1 ; is = true ; } else if ( b == arr [ i ] ) b_count ++ ; else if ( ! is1 ) { c = arr [ i ] ; c1 = i + 1 ; is1 = true ; } } ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier))) (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (false)) declarator: (variable_declarator name: (identifier) value: (false))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (for_statement init: (assignment_expression left: (identifier) right: (decimal_integer_literal)) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (unary_expression operand: (decimal_integer_literal))))) (return_statement))) (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (for_statement init: (assignment_expression left: (identifier) right: (decimal_integer_literal)) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))) consequence: (expression_statement (update_expression (identifier))) alternative: (if_statement condition: (parenthesized_expression (unary_expression operand: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))) (expression_statement (update_expression (identifier))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (identifier) right: (true)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))) consequence: (expression_statement (update_expression (identifier))) alternative: (if_statement condition: (parenthesized_expression (unary_expression operand: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (identifier) right: (true))))))))))))