package main

import "fmt"

func main() {
	var inputs int;
	fmt.Scanln(&inputs)

	counterEven := make([]int, 2)
	counterOdd := make([]int, 2)

	for i := 0; i < inputs; i++ {
		var v int;
		fmt.Scanf("%d", &v)

		switch v%2 {
		case 0:
			counterEven[0] = i
			counterEven[1]++
		default:
			counterOdd[0] = i
			counterOdd[1]++
		}
	}

	if counterEven[1] == 1 {
		fmt.Println(counterEven[0] + 1)
	} else {
		fmt.Println(counterOdd[0] + 1)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	var n, x int
	scr := bufio.NewReader(os.Stdin)
	// ocr := bufio.NewWriter(os.Stdout)

	fmt.Scanln(&n)

	ld := make(map[string][]int)

	for i := int(0); i < n; i++ {
		fmt.Fscanf(scr, "%d", &x)

		if x%2 == 0 {
			if ld["even"] == nil {
				ld["even"] = append(ld["even"], 1)
				ld["even"] = append(ld["even"], i)
			} else {
				ld["even"][0]++
				ld["even"][1] = i
			}
		} else {
			if ld["odd"] == nil {
				ld["odd"] = append(ld["odd"], 1)
				ld["odd"] = append(ld["odd"], i)
			} else {
				ld["odd"][0]++
				ld["odd"][1] = i
			}
		}
	}

	if ld["even"][0] < ld["odd"][0] {
		fmt.Println(ld["even"][1] + 1)
	} else {
		fmt.Println(ld["odd"][1] + 1)
	}
}

package main
import "fmt"

func main() {
	var (
		n, num, lastOdd, lastEven, oddNum, evenNum int
	)
	fmt.Scanln(&n)
	for i := 1; i <= n; i ++ {
		fmt.Scanf("%d", &num)
		if num%2 == 1 {
			lastOdd = i
			oddNum ++
		}else {
			lastEven = i
			evenNum ++
		}

		if oddNum > 0 && evenNum > 0 {
			if oddNum > evenNum {
				fmt.Println(lastEven)
				break;
			}

			if evenNum > oddNum {
				fmt.Println(lastOdd)
				break;
			}
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func toInt(buf []byte) (n int) {
	for _, v := range buf {
		n = n*10 + int(v-'0')
	}
	return
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanner.Scan()
	var lEvenIndex, lOddIndex, evenCount, oddCount, i = -1, -1, 0, 0, 1

	for scanner.Scan() {
		var num = toInt(scanner.Bytes())
		if num % 2 == 0 {
			lEvenIndex = i
			evenCount++
		}else {
			lOddIndex = i
			oddCount++
		}
		i++
	}
	if oddCount == 1 {
		fmt.Println(lOddIndex)
	}else {
		fmt.Println(lEvenIndex)
	}
}

package main

import (
	"fmt"
)

func main() {
	var n int
	var lastEven, lastNotEven, countEven, countNotEven int64
	_, _ = fmt.Scanf("%d\n", &n)
	arr := make([]int64, n, n)
	for i := 0; i < n; i++ {
		_, _ = fmt.Scanf("%d", &arr[i])
	}
	for index, element := range arr {
		if element % 2 == 0 {
			lastEven = int64(index)
			countEven++
		} else {
			lastNotEven = int64(index)
			countNotEven++
		}
	}
	if countNotEven == 1 {
		fmt.Printf("%d", lastNotEven + 1)
	} else {
		fmt.Printf("%d", lastEven + 1)
	}
}

/*
%t: для вывода значений типа boolean (true или false)
%b: для вывода целых чисел в двоичной системе
%c: для вывода символов, представленных числовым кодом
%d: для вывода целых чисел в десятичной системе
%o: для вывода целых чисел в восьмеричной системе
%q: для вывода символов в одинарных кавычках
%x: для вывода целых чисел в шестнадцатиричной системе, буквенные символы числа имеют нижний регистр a-f
%X: для вывода целых чисел в шестнадцатиричной системе, буквенные символы числа имеют верхний регистр A-F
%U: для вывода символов в формате кодов Unicode, например, U+1234
%e: для вывода чисел с плавающей точкой в экспоненциальном представлении, например, -1.234456e+78
%E: для вывода чисел с плавающей точкой в экспоненциальном представлении, например, -1.234456E+78
%f: для вывода чисел с плавающей точкой, например, 123.456
%F: то же самое, что и %f
%g: для длинных чисел с плаващей точкой используется %e, для других - %f
%G: для длинных чисел с плаващей точкой используется %E, для других - %F
%s: для вывода строки
%p: для вывода значения указателя - адреса в шестнадцатеричном представлении
*/

package main
import (
	"fmt"
)
func main() {
	var n,x int
	ev,lo,le :=0,0,0
	fmt.Scan(&n)
	for i:=1; i<=n;i++ {
		fmt.Scan(&x)
		if x%2==0 {
			ev++
			le=i
		} else {
			ev--
			lo=i
		}
	}
	if ev>0 {
		fmt.Println(lo)
	} else {
		fmt.Println(le)
	}

}

package main

import "fmt"

func main() {
	var n int
	var x int
	var odds, evens int
	var lastodd, lasteven int

	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		fmt.Scan(&x)
		if x%2 == 0 {
			evens++
			lasteven = i + 1
		} else {
			odds++
			lastodd = i + 1
		}
	}
	if evens > odds {
		fmt.Println(lastodd)
	} else {
		fmt.Println(lasteven)
	}

}

package main

import (
  "fmt"
)

func main() {
  var a int
  fmt.Scan(&a)
  arr := make([]int, a)
  for i := 0; i < a; i++ {
    fmt.Scan(&arr[i])
    arr[i] %= 2
  }
  x := 0
  y := 0
  idxx := 0
  idxy := 0
  for idx,val := range arr {
    if val == 1{
      x++
      idxx = idx
    } else {
      y++
      idxy = idx
    }
  }
  if x == 1 {
    fmt.Print(idxx+1)
  }
  if y == 1 {
    fmt.Print(idxy+1)
  }
}

// https://codeforces.com/contest/25/problem/A

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

func main() {
	defer writer.Flush()

	var n int
	scanf("%d\n", &n)
	var ctOdd, ctEven, idxOdd, idxEven int
	arr := make([]int, n+1)
	for i:=0;i<n;i++ {
		scanf("%d ", &arr[i])
		if arr[i]%2==0 {
			ctEven++
			idxEven = i
		} else {
			ctOdd++
			idxOdd = i
		}
	}

	if ctEven == 1 {
		printf("%d\n", idxEven+1)
	} else {
		printf("%d\n", idxOdd+1)
	}
}

package main

import "fmt"

func main() {
  var n int
  var i int
  var buf int
  var ruf int
  var res int
  fmt.Scanf("%d", &n)
  fmt.Scanln()
  fmt.Scanf("%d", &ruf)
  res = 1
  for i = 0; i < n-1; i++ {
    fmt.Scanf("%d", &buf)
    //fmt.Println("buf----", buf, "----ruf----",ruf, "----i----", i)
    if buf%2 != ruf%2 {res = i+2; break}
  }
  if res==2{
      fmt.Scanf("%d", &ruf)
      if buf%2==ruf%2{
          res=1

      }

  }
  fmt.Println(res)
}

package main

import "fmt"

func main() {
    var n,a,odd,even int
    fmt.Scan(&n)
    for i := 0; i < n; i++ {
        fmt.Scan(&a)
        if a%2 == 0 {
            if even != 0 { even = -1 } else { even = i+1 }
        } else {
            if odd != 0 { odd = -1 } else { odd = i+1 }
        }
    }
    if even == -1 { fmt.Println(odd) } else { fmt.Println(even) }
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var N int
var numbers []uint8

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	scanner.Scan()
	erhang := scanner.Text()
	// fmt.Println(erhang)
	segs := strings.Split(erhang, " ")
	numbers = make([]uint8, len(segs))
	var shu int
	for idx := range segs {
		shu, _ = strconv.Atoi(segs[idx])
		numbers[idx] = uint8(shu) % 2
	}
	//////////////////////////////////////
	one := numbers[0]
	two := numbers[1]
	var mode bool
	if one == two {
		mode = true
	} else {
		mode = false
	}
	///////////////////////////////////////
	if mode {
		numbers = numbers[2:]
		qian := two
		for idx := range numbers {
			if numbers[idx] != qian {
				fmt.Println(idx + 3)
				return
			}
			qian = numbers[idx]
		}
	} else {
		if numbers[2] == one {
			fmt.Println(2)
		} else {
			fmt.Println(1)
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func checkNumbers(numbers []string, modulo int) int {
	for i := 0; i < len(numbers); i++ {
		tmp, _ := strconv.Atoi(numbers[i])
		if tmp%2 != modulo {
			return i + 1
		}
	}
	//Should not return -1
	return -1
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	n := 0
	if scanner.Scan() {
		line := scanner.Text()
		fmt.Sscanf(line, "%d", &n)
	}

	if scanner.Scan() {
		line := scanner.Text()

		numbers := strings.Fields(line)

		evenCount := 0
		oddCount := 0
		for i := 0; i < 3; i++ {
			tmp, _ := strconv.Atoi(numbers[i])
			if tmp%2 == 0 {
				evenCount += 1
			} else {
				oddCount += 1
			}
		}

		if evenCount > oddCount {
			fmt.Println(checkNumbers(numbers, 0))
		} else {
			fmt.Println(checkNumbers(numbers, 1))
		}
	}
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	var x int
	var arr []int
	for i := 0; i < n; i++ {
		fmt.Scan(&x)
		arr = append(arr, x)
	}

	var evenC, oddC, lastEven, lastOdd int
	for i := 0; i < n; i++ {
		if arr[i]%2 == 0 {
			lastEven = i
			evenC++
		} else {
			lastOdd = i
			oddC++
		}
	}

	if evenC == 1 {
		fmt.Println(lastEven + 1)
	} else {
		fmt.Println(lastOdd + 1)
	}
}

package main

import(
	"fmt"
)

func main() {

	n := 0
	fmt.Scanf("%d\n", &n)
	arr := []int{}
	tmp := 0
	sum := 0

	for i := 0; i < n; i++ {
		fmt.Scanf("%d",&tmp)
		sum += tmp
		arr = append(arr, tmp)
	}
	evenCnt := 0

	for i := 0; i < n; i++ {
		if arr[i] % 2 == 0 {
			evenCnt++
		}
	}

	for i := 0; i < n; i++ {
		if evenCnt == n-1 {
			if arr[i] % 2 != 0 {
				fmt.Println(i+1)
				break
			}
		} else {
			if arr[i] % 2 == 0 {
				fmt.Println(i+1)
				break
			}
		}
	}
}

package main

import "fmt"

func main() {
	var n, a, b int
	var x [101]int

	fmt.Scanf("%d", &n)
	for i := 0; i < n + 1; i++ {
		fmt.Scanf("%d", &x[i])
	}

	ch :=0
	nch :=0
	for i:=1; i <= n; i++{
		if x[i] % 2 == 0 {
			ch++
			a = i
		}else{
			nch++
			b = i
		}
	}

	if ch > nch{
		fmt.Println(b)
	}else if nch > ch{
		fmt.Println(a)
	}
}

package main

import "fmt"

func main() {
	var n, v int
	fmt.Scan(&n)

	envInd := 0
	oddInd := 0
	find := 0
	for i := 1; i <= n; i++ {
		fmt.Scan(&v)
		if v%2 == 0 {
			if envInd != 0 {
				find = 1
			} else {
				envInd = i
			}
		} else {
			oddInd = i
		}
	}

	if find == 0 {
		fmt.Print(envInd)
	} else {
		fmt.Print(oddInd)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader

func init() {
	stdin := os.Stdin
	// stdin, _ = os.Open("1.in")
	reader = bufio.NewReaderSize(stdin, 1<<20)
}

func read() (n int) {
	fmt.Fscan(reader, &n)
	return
}

var n int
var a []int

func main() {
	n = read()
	a = make([]int, n)

	var odd, even, oddSum, evenSum int
	for i := 0; i < n; i++ {
		a[i] = read()
		if a[i]%2 == 1 {
			oddSum++
			odd = i + 1
		} else {
			evenSum++
			even = i + 1
		}
	}

	if oddSum == 1 {
		fmt.Println(odd)
	} else {
		fmt.Println(even)
	}
}

package main

import (
	"bufio"
	"bytes"
	"fmt"
	"io"
	"os"
	"strconv"
)

var DEBUG = true

func main() {
	defer Flush()

	N, A := readInts(0)
	_ = N

	var count, idx [2]int
	for i, v := range A {
		c := v % 2
		count[c]++
		idx[c] = i + 1
	}

	for c := range []int{0, 1} {
		if count[c] == 1 {
			println(idx[c])
		}
	}
}

// -----------------------------------------------------------------------------

// IO helper functions

// Returns next token from input.  It must be initialized by SetInput()
// before the first call.
var nextToken func() ([]byte, error)
var nextLine func() ([]byte, error)

// Holds a buffer for output.  It must be initialized by SetOutput().
// All IO fucntions (read*() and [e]print*()) should write to OutputWriter
// instead of this.
var OutputBuffer *bufio.Writer

// Holds an io.Writer.  It must be initialized by SetOutput()
var OutputWriter io.Writer

// Set IO functions for interactive input/output.
func SetInteractive(w io.Writer, r io.Reader) {
	SetUnbefferedInput(r)
	OutputBuffer = nil
	OutputWriter = w
}

// Setup OutputBuffer and OutputWriter.
func SetOutput(w io.Writer) {
	OutputBuffer = bufio.NewWriter(w)
	OutputWriter = OutputBuffer
}

// Flushes OutputBuffer
func Flush() {
	if OutputBuffer != nil {
		OutputBuffer.Flush()
	}
}

// Returns true if c is a white space
func IsSpace(c byte) bool {
	switch c {
	case '\t', '\n', '\v', '\f', '\r', ' ':
		return true
	}
	return false
}

func IsNewLine(c byte) bool {
	switch c {
	case '\n', '\r':
		return true
	}
	return false
}

// Setup nextToken with input buffer.
func SetInput(r io.Reader) {
	buf := new(bytes.Buffer)
	var b []byte

	var i int
	rest := func() ([]byte, error) {
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		return b[j:i], nil
	}
	initial := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextToken = rest
		return rest()
	}
	nextToken = initial

	restLn := func() ([]byte, error) {
		for i < len(b) && IsNewLine(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsNewLine(b[i]) {
			i++
		}
		return b[j:i], nil
	}

	initialLn := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextLine = restLn
		return restLn()
	}
	nextLine = initialLn
}

// Setup nextToken without input buffer.
func SetUnbefferedInput(r io.Reader) {
	buf := bufio.NewReader(r)
	var b []byte

	var i int
	nextToken = func() ([]byte, error) {
		var err error
		if i == len(b) {
			b, err = buf.ReadBytes('\n')
			if err != nil {
				return nil, err
			}
			i = 0
			j := len(b) - 1
			for 0 <= j && IsSpace(b[j]) {
				j--
			}
			b = b[0 : j+1]
		}
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		if i == j {
			return nil, io.ErrUnexpectedEOF
		}
		return b[j:i], nil
	}
}

// -----------------------------------------------------------------------------

// IO functions

// Reads next token and return it as []byte
func readb() []byte {
	b, err := nextToken()
	if err != nil {
		panic(err)
	}
	return b[:len(b):len(b)]
}

// Reads next token and return it as string
func reads() string {
	return string(readb())
}

// Read next line as []byte.  Trailing '\n' will not be included.
// See also comments on readb()
func readbln() []byte {
	b, err := nextLine()
	if err != nil {
		panic(err)
	}
	return b[:len(b):len(b)]
}

// Read next line as string
func readsln() string {
	return string(readbln())
}

// Reads next token and return it as int64
func readll() int64 {
	i, err := strconv.ParseInt(reads(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// Reads next token and return it as int
func readi() int {
	return int(readll())
}

// Reads next token and return it as float64
func readf() float64 {
	f, err := strconv.ParseFloat(reads(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// Write args to OutputWriter with the format f
func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(OutputWriter, f, args...)
}

// Write args to OutputWriter without format
func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(OutputWriter, args...)
}

// Write args to stderr with the format f
func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// Write args to stderr without format
func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func dbgf(f string, args ...interface{}) {
	if !DEBUG {
		return
	}
	fmt.Fprintf(os.Stderr, f, args...)
}

func dbg(args ...interface{}) {
	if !DEBUG {
		return
	}
	fmt.Fprintln(os.Stderr, args...)
}

// -----------------------------------------------------------------------------

// Utilities

func sumSlice(a []int) int {
	var res int
	for _, v := range a {
		res += v
	}
	return res
}

func sumSlicell(a []int64) int64 {
	var res int64
	for _, v := range a {
		res += v
	}
	return res
}

func readInts(N int) (int, []int) {
	if N == 0 {
		N = readi()
	}
	a := make([]int, N)
	for i := range a {
		a[i] = readi()
	}
	return N, a
}

func readIntsll(N int) (int, []int64) {
	if N == 0 {
		N = readi()
	}
	a := make([]int64, N)
	for i := range a {
		a[i] = readll()
	}
	return N, a
}

// -----------------------------------------------------------------------------

// Simple math functions

const (
	// big prime
	INF  = 1000000007
	INF2 = 1000000009
	INF3 = 998244353
)

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func minll(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func minf(a, b float64) float64 {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func maxll(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func maxf(a, b float64) float64 {
	if a < b {
		return b
	}
	return a
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absll(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

func absf(a float64) float64 {
	if a < 0 {
		return -a
	}
	return a
}

// egcd(a, b) returns d, x, y:
//   d is gcd(a,b)
//   x, y are  integers that satisfy ax + by = d
func egcd(a, b int) (int, int, int) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcd(b, a%b)
	return d, y, x - a/b*y
}

func egcdll(a, b int64) (int64, int64, int64) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcdll(b, a%b)
	return d, y, x - a/b*y
}

func gcd(a, b int) int {
	d, _, _ := egcd(a, b)
	return d
}

func gcdll(a, b int64) int64 {
	d, _, _ := egcdll(a, b)
	return d
}

// set up IO functions
func init() {
	// for non-interactive
	SetInput(os.Stdin)
	SetOutput(os.Stdout)

	// Enable below when interactive.  Its ok to leave above intact.
	// SetInteractive(os.Stdout, os.Stdin)
}

package main

import (
	"fmt"
)

func main() {
	var N int
	var iE,iD,sE,sD,temp int
	fmt.Scanf("%d\n",&N)
	for i:=0 ; i<N ; i++{
		fmt.Scanf("%d",&temp)
		if(temp%2 == 0){
			iE = i
			sE += 1
		}else{
			iD = i
			sD += 1
		}
	}
	if(sE < sD){
		fmt.Println(iE+1)
	}else{
		fmt.Println(iD+1)
	}
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"sync"
)

func main() {
	n := int(ReadInt64())
	a := ReadInt64Slice(n)

	evn := []int{}
	odd := []int{}

	for i := 0; i < n; i++ {
		if a[i]%2 == 0 {
			evn = append(evn, i)
		} else {
			odd = append(odd, i)
		}
	}
	if len(evn) == 1 {
		fmt.Println(evn[0] + 1)
	} else {
		fmt.Println(odd[0] + 1)
	}
	close(out)
	outWg.Wait()
}

/*********************** I/O ***********************/

var out chan string
var in *bufio.Scanner
var outWg *sync.WaitGroup

func init() {
	//set input
	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(2e+5))
	in.Split(bufio.ScanWords)

	// set output
	out = make(chan string, 16)
	outWg = &sync.WaitGroup{}
	outWg.Add(1)

	writer := bufio.NewWriterSize(os.Stdout, int(2e+5))
	go func(writer *bufio.Writer) {
		defer outWg.Done()
		defer writer.Flush()

		for line := range out {
			writer.WriteString(line + "\n")
		}
	}(writer)
}

func ReadString() string {
	in.Scan()
	return in.Text()
}

func ReadStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ReadString()
	}
	return s
}

func ReadInt64() int64 {
	intStr := ReadString()
	i, err := strconv.ParseInt(intStr, 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func ReadInt64Slice(n int) []int64 {
	arr := make([]int64, n)
	for i := 0; i < n; i++ {
		arr[i] = ReadInt64()
	}
	return arr
}

/*********************** Utils ***********************/

func Max(args ...int64) int64 {
	maxV := int64(math.MinInt64)
	for _, v := range args {
		if v > maxV {
			maxV = v
		}
	}
	return maxV
}

func Min(args ...int64) int64 {
	minV := int64(math.MaxInt64)
	for _, v := range args {
		if v < minV {
			minV = v
		}
	}
	return minV
}

func GCD(a, b int64) int64 {
	if (a == 0) {
		return b
	}
	return GCD(b%a, a)
}

func LCM(a, b int64) int64 {
	return a / GCD(a, b) * b
}

func S(v int64) string {
	return strconv.FormatInt(v, 64)
}

package main

import (
	"fmt"
)

func main() {
	var n, i, e, ei, oi int
	fmt.Scan(&n)
	var arr [100]int
	for i = 0; i < n; i++ {
		fmt.Scan(&arr[i])
		if arr[i]%2 == 0 {
			e++
			ei = i
		} else {
			oi = i
		}
	}
	if e == 1 {
		fmt.Println(ei + 1)
	} else {
		fmt.Println(oi + 1)
	}
}

package main
import (
	"fmt"
)
func main() {
	var n,x int
	ev,lo,le :=0,0,0
	fmt.Scan(&n)
	for i:=1; i<=n;i++ {
		fmt.Scan(&x)
		if x%2==0 {
			ev++
			le=i
		} else {
			ev--
			lo=i
		}
	}
	if ev>0 {
		fmt.Println(lo)
	} else {
		fmt.Println(le)
	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)

	// The number of inputs
	var n int
	fmt.Fscanf(in, "%d\n", &n)

	// THe first three inputs
	var a, b, c int
	fmt.Fscanf(in, "%d %d %d", &a, &b, &c)

	sum := 0
	sum = sum<<1 | (a % 2)
	sum = sum<<1 | (b % 2)
	sum = sum<<1 | (c % 2)

	var ind int
	switch sum {
	case 3, 4:
		ind = 1
	case 2, 5:
		ind = 2
	case 1, 6:
		ind = 3
	default:
		ind = -1
	}

	t := 0
	item := 0
	if -1 == ind {
		if 0 == sum {
			item = 1
		} else {
			item = 0
		}

		for i := 3; i < n; i++ {
			fmt.Fscanf(in, " %d", &t)
			if item == (t % 2) {
				ind = i + 1
			}
		}
	} else {
		// Ignore the rest inputs
		for i := 3; i < n; i++ {
			fmt.Fscanf(in, " %d", &t)
		}
	}

	fmt.Fscanf(in, "\n")

	// Display results
	fmt.Fprintf(out, "%d\n", ind)
	out.Flush()
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	defer writer.Flush()

	var (
		n       int
		num     int
		even    int
		odd     int
		pos     int
		posEven int
		posOdd  int
	)

	scanf("%d\n", &n)

	for i := 0; i < n; i++ {
		pos++
		scanf("%d", &num)
		if num%2 == 0 {
			even++
			posEven = pos
		} else {
			odd++
			posOdd = pos
		}
	}

	if odd > 1 {
		printf("%d\n", posEven)
	} else {
		printf("%d\n", posOdd)
	}
}

package main

import "fmt"

func main() {
    var n int
    fmt.Scan(&n)

    nums := make([]int, n, n)
    for i := 0; i < n; i++ {
        fmt.Scan(&nums[i])
    }

    even := 0
    for i := 0; i < 3; i++ {
        if nums[i] % 2 == 0 {
            even += 1
        }
    }

    mod := 0
    if even >= 2 {
        mod = 1
    }

    var ret int
    for i := 0; i < n; i++ {
        if nums[i] % 2 == mod {
            ret = i + 1
            break
        }
    }

    fmt.Println(ret)
}

//  URL: http://codeforces.com/problemset/problem/25/A
//  ~ Basic Implementation Problem

package main

import (
	"bufio"
	"fmt"
	"os"
)

func solve(arr []int) int {
	evenCount := 0
	oddCount := 0
	var evenIndex, oddIndex int
	for i, elem := range arr {
		if elem%2 == 0 {
			evenCount += 1
			evenIndex = i + 1
		} else {
			oddCount += 1
			oddIndex = i + 1
		}
	}
	if oddCount >= 2 {
		return evenIndex
	}
	return oddIndex
}

func main() {
	reader, writer := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer writer.Flush()
	var n int
	fmt.Fscanf(reader, "%d\n", &n)
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(reader, "%d", &arr[i])
	}
	fmt.Fprintf(writer, "%d\n", solve(arr))
}

package main

import (
	"fmt"
	"bufio"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func scanf(f string, a... interface{}) {
	fmt.Fscanf(reader, f, a...)
}

func printf(f string, a... interface{}) {
	fmt.Fprintf(writer, f, a...)
}

func main() {

	var T, i uint

	evens := []uint{}
	odds := []uint{}

	scanf("%d \n", &T)
	var temp uint
	for i=1; i<=T; i++ {

		scanf("%d ", &temp)
		if temp % 2 == 0 {
			evens = append(evens, i)
		}else {
			odds = append(odds, i)
		}

	}

	if len(evens) == 1 {
		fmt.Println(evens[0])
	}else {
		fmt.Println(odds[0])
	}

}

package main

import "fmt"

func main() {
	length := 0
	fmt.Scanln(&length)
	numbers := make([]int, length)
	for i := 0; i < length; i++ {
		fmt.Scanf("%d",&numbers[i])
	}
	//fmt.Println(numbers)

	var even,odd,ans1,ans2 int
	for i:=0;i<length;i++{
		if(numbers[i]%2==0){
			even++
			ans1=i+1
		}else {
			odd++
			ans2 =i+1
		}

	}
	if even>odd{
		fmt.Printf("%d",ans2)
	}else{
		fmt.Printf("%d",ans1)
	}

}

package main
import (
	 "fmt"
)

func main() {
	 var n int

	 var odd []int
	 var even []int
	 fmt.Scanf("%d", &n)

	 for i:=1; i<=n; i ++ {
	 	   var x int
	 	   fmt.Scan( &x)

	 	   if x % 2 == 0 {
	 	   		odd = append(odd, i)
	 	   } else {
	 	   	    even = append(even, i)
	 	   }
	 }

	 if len(odd) == 1 {
	 	  fmt.Printf("%d", odd[0])
	 } else {
	 	  fmt.Printf("%d", even[0])
	 }
	 // fmt.Println(odd, even)
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	var line string
	var arrS []string
	var tmp, lchet, lnehet, summchet, summnechet int
	var flagchet, flagnechet bool
	reader := bufio.NewReader(os.Stdin)
	line, _ = reader.ReadString('\n')
	line, _ = reader.ReadString('\n')
	arrS = strings.Split(strings.TrimSpace(line), " ")
	for j := range arrS {
		tmp, _ = strconv.Atoi(arrS[j])
		if tmp%2 == 0 {
			lchet = j + 1
			summchet++
			flagchet = true
		} else {
			lnehet = j + 1
			summnechet++
			flagnechet = true
		}
		if summchet >= 2 && flagnechet {
			fmt.Println(lnehet)
			os.Exit(0)
		}
		if summnechet >= 2 && flagchet {
			fmt.Println(lchet)
			os.Exit(0)
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	var n int
	var idx,idx2,it,it2 int = 0,0,0,0

	fmt.Scan(&n)

	for i := 1; i <= n; i++ {
		var num int
		fmt.Scan(&num)

		if num % 2 == 0 {
			idx++
			it = i
		}else {
			idx2++
			it2 = i
		}
	}

	if idx > idx2 {
		fmt.Println(it2)
	}else{
		fmt.Println(it)
	}
}

package main

import (
        "os"
        "bufio"
        "fmt"
)

var r *bufio.Reader = bufio.NewReader(os.Stdin)
var w *bufio.Writer = bufio.NewWriter(os.Stdout)

func solve(ar []int) int {
        o, e := 0, 0
        for _, v := range ar {
                if v % 2 == 0 {
                        e += 1
                } else {
                        o += 1
                }
        }
        var r int
        if o == 1 {
                r = 1
        } else {
                r = 0
        }
        ans := -1
        for i, v := range ar {
                if v % 2 == r {
                        ans = i+1
                        break
                }
        }

        return ans
}

func main() {
        defer w.Flush()

        var n int
        fmt.Fscanf(r, "%d\n", &n)
        ar := make([]int, n)
        for i := 0; i < n; i++ {
                fmt.Fscanf(r, "%d ", &ar[i])
        }

        fmt.Fprintf(w, "%v", solve(ar))
}

package main

import (
	"bufio"
	"fmt"
	"math/rand"
	"os"
)

func dsuGet(p []int, v int) int {
	if v == p[v] {
		return v
	}
	p[v] = dsuGet(p, p[v])
	return p[v]
}

func dsuUnite(p []int, a, b int) {
	a = dsuGet(p, a)
	b = dsuGet(p, b)
	if rand.Int() & 1 == 1 {
		a, b = b, a
	}
	if a != b {
		p[a] = b
	}
}

func main() {

	//stdin, err := os.Open("file.in")
	//if err != nil {
	//	panic(err)
	//}
	//defer stdin.Close()
	stdin := os.Stdin
	reader := bufio.NewReaderSize(stdin, 1024*1024)

	//stdout, err := os.Create("file.out")
	//if err != nil {
	//	panic(err)
	//}
	//defer stdout.Close()
	stdout := os.Stdout
	writer := bufio.NewWriterSize(stdout, 1024*1024)

	var n int
	fmt.Fscanf(reader, "%d\n", &n)

	var odd, even, oddC, evenC, a int

	for i := 0; i < n; i++ {
		fmt.Fscanf(reader, "%d", &a)
		if a & 1 == 1 {
			odd = i + 1
			oddC++
		} else {
			even = i + 1
			evenC++
		}
	}

	if oddC == 1 {
		fmt.Fprintf(writer, "%d\n", odd)
	} else {
		fmt.Fprintf(writer, "%d\n", even)
	}

	writer.Flush()
}

package main

import "fmt"

func main()  {
	var n, q, w int
	res := true
	q, w = -1, -1
	fmt.Scanf("%d\n", &n)
	for i, tmp := 0, 0; i < n; i++ {
		fmt.Scanf("%d", &tmp)
		if tmp % 2 == 0 {
			if q != -1 {
				res = false
			}
			q = i + 1
		} else {
			if w != -1 {
				res = true
			}
			w = i + 1
		}
	}

	if res {
		fmt.Println(q)
	} else {
		fmt.Println(w)
	}

}

package main

// https://codeforces.com/problemset/problem/25/A

import "fmt"

func taskSolution(a []int) int {
	first, second, third := a[0]%2, a[1]%2, a[2]%2
	if !(first == second && second == third) {
		switch {
		case first == second:
			return 3
		case first == third:
			return 2
		default:
			return 1
		}
	}
	for i := 3; i < len(a); i += 1 {
		if a[i]%2 != first {
			return i + 1
		}
	}
	return 0
}

func main() {
	var n int
	if _, err := fmt.Scan(&n); err != nil {
		panic(err)
	}

	a := []int{}
	for i := 0; i < n; i += 1 {
		var ai int
		if _, err := fmt.Scan(&ai); err != nil {
			panic(err)
		}
		a = append(a, ai)
	}

	fmt.Println(taskSolution(a))
}

package main

import "fmt"

func main() {

	var n int
	fmt.Scanln(&n)
	var tem int
	var f0 int = 0 // 上上次
	var f1 int = 0 // 上一个
	var f2 int = 0 // 当前
	var arr [100]int

	for i := 0; i < n; i++ {
		fmt.Scan(&tem)
		arr[i] = tem
	}

	f0 = check(arr[0]) //上上个
	f1 = check(arr[1])
	f2 = check(arr[2])
	if f0 == f1 && f1 == f2 && f2 == f0 {

	} else {
		if f0 == f1 {
			fmt.Println(3)
			return
		}
		if f0 == f2 {
			fmt.Println(2)
			return
		}
		if f1 == f2 {
			fmt.Println(1)
			return
		}
	}
	for i := 3; i < n; i++ {
		f0 = f1
		f1 = f2
		f2 = check(arr[i])
		if f2 != f1 {
			fmt.Println(i + 1)
			return
		}

	}

}

func check(i int) int {

	if i%2 == 0 {
		return 0
	} else {
		return 1
	}

}

package main

import "fmt"

func main() {
	var n, a int
	var fo, fe int
	var ec, oc int
	fe = 0
	fo = 0
	ec = 0
	oc = 0
	fmt.Scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a)
		if a%2 == 0 {
			if ec == 0 {
				fe = i + 1
			}
			ec++
		} else {
			if oc == 0 {
				fo = i + 1
			}
			oc++
		}
	}
	if ec == 1 {
		fmt.Println(fe)
	} else {
		fmt.Println(fo)
	}
}

package main

import (
    "fmt"
)

func main() {
    n := 0;
    fmt.Scanf("%d\n", &n);
    a := make([]int, n);
    for i := 0; i < n; i++ {
        d := 0;
        fmt.Scanf("%d", &d);
        a[i] = d;
    }

    count := 0;
    for i, v := range(a) {
        a[i] = v % 2;
        count += a[i];
    }
    x := 1;

    if (count >= 2) {
        x = 0;
    }

    for i := 0; i < len(a); i++ {
        if a[i] == x {
            fmt.Printf("%d\n", i + 1);
            break;
        }
    }

}

package main

import (
	"fmt"
)

func main() {
	var n int
	var lastEven, lastNotEven, countEven, countNotEven int64
	_, _ = fmt.Scanf("%d", &n)
	arr := make([]int64, n, n)
	for i := 0; i < n; i++ {
		_, _ = fmt.Scanf("%d", &arr[i])
	}
	for index, element := range arr {
		if element % 2 == 0 {
			lastEven = int64(index)
			countEven++
		} else {
			lastNotEven = int64(index)
			countNotEven++
		}
	}
	if countNotEven == 1 {
		fmt.Printf("%d", lastNotEven + 1)
	} else {
		fmt.Printf("%d", lastEven + 1)
	}
}

/*
%t: для вывода значений типа boolean (true или false)
%b: для вывода целых чисел в двоичной системе
%c: для вывода символов, представленных числовым кодом
%d: для вывода целых чисел в десятичной системе
%o: для вывода целых чисел в восьмеричной системе
%q: для вывода символов в одинарных кавычках
%x: для вывода целых чисел в шестнадцатиричной системе, буквенные символы числа имеют нижний регистр a-f
%X: для вывода целых чисел в шестнадцатиричной системе, буквенные символы числа имеют верхний регистр A-F
%U: для вывода символов в формате кодов Unicode, например, U+1234
%e: для вывода чисел с плавающей точкой в экспоненциальном представлении, например, -1.234456e+78
%E: для вывода чисел с плавающей точкой в экспоненциальном представлении, например, -1.234456E+78
%f: для вывода чисел с плавающей точкой, например, 123.456
%F: то же самое, что и %f
%g: для длинных чисел с плаващей точкой используется %e, для других - %f
%G: для длинных чисел с плаващей точкой используется %E, для других - %F
%s: для вывода строки
%p: для вывода значения указателя - адреса в шестнадцатеричном представлении
*/

package main

import "fmt"

func main() {
	var n int
	var lastEven, lastNotEven, countEven, countNotEven int64
	_, _ = fmt.Scanf("%d", &n)
	arr := make([]int64, n, n)
	for i := 0; i < n; i++ {
		_, _ = fmt.Scanf("%d", &arr[i])
	}
	for index, element := range arr {
		if element % 2 == 0 {
			lastEven = int64(index)
			countEven++
		} else {
			lastNotEven = int64(index)
			countNotEven++
		}
	}
	if countNotEven == 1 {
		fmt.Printf("%d\n", lastNotEven + 1)
	} else {
		fmt.Printf("%d\n", lastEven + 1)
	}
}

/*
%t: для вывода значений типа boolean (true или false)
%b: для вывода целых чисел в двоичной системе
%c: для вывода символов, представленных числовым кодом
%d: для вывода целых чисел в десятичной системе
%o: для вывода целых чисел в восьмеричной системе
%q: для вывода символов в одинарных кавычках
%x: для вывода целых чисел в шестнадцатиричной системе, буквенные символы числа имеют нижний регистр a-f
%X: для вывода целых чисел в шестнадцатиричной системе, буквенные символы числа имеют верхний регистр A-F
%U: для вывода символов в формате кодов Unicode, например, U+1234
%e: для вывода чисел с плавающей точкой в экспоненциальном представлении, например, -1.234456e+78
%E: для вывода чисел с плавающей точкой в экспоненциальном представлении, например, -1.234456E+78
%f: для вывода чисел с плавающей точкой, например, 123.456
%F: то же самое, что и %f
%g: для длинных чисел с плаващей точкой используется %e, для других - %f
%G: для длинных чисел с плаващей точкой используется %E, для других - %F
%s: для вывода строки
%p: для вывода значения указателя - адреса в шестнадцатеричном представлении
*/

package main

import (
	"fmt"
)

func main() {
	var n int
	var lastEven, lastNotEven, countEven, countNotEven int64
	_, _ = fmt.Scanf("%d", &n)
	arr := make([]int64, n, n)
	for i := 0; i < n; i++ {
		_, _ = fmt.Scanf("%d", &arr[i])
	}
	for index, element := range arr {
		if element % 2 == 0 {
			lastEven = int64(index)
			countEven++
		} else {
			lastNotEven = int64(index)
			countNotEven++
		}
	}
	if countNotEven == 1 {
		fmt.Printf("%d\n", lastNotEven + 1)
	} else {
		fmt.Printf("%d\n", lastEven + 1)
	}
}

/*
%t: для вывода значений типа boolean (true или false)
%b: для вывода целых чисел в двоичной системе
%c: для вывода символов, представленных числовым кодом
%d: для вывода целых чисел в десятичной системе
%o: для вывода целых чисел в восьмеричной системе
%q: для вывода символов в одинарных кавычках
%x: для вывода целых чисел в шестнадцатиричной системе, буквенные символы числа имеют нижний регистр a-f
%X: для вывода целых чисел в шестнадцатиричной системе, буквенные символы числа имеют верхний регистр A-F
%U: для вывода символов в формате кодов Unicode, например, U+1234
%e: для вывода чисел с плавающей точкой в экспоненциальном представлении, например, -1.234456e+78
%E: для вывода чисел с плавающей точкой в экспоненциальном представлении, например, -1.234456E+78
%f: для вывода чисел с плавающей точкой, например, 123.456
%F: то же самое, что и %f
%g: для длинных чисел с плаващей точкой используется %e, для других - %f
%G: для длинных чисел с плаващей точкой используется %E, для других - %F
%s: для вывода строки
%p: для вывода значения указателя - адреса в шестнадцатеричном представлении
*/

package main

import "fmt"

func main() {
  var n int
  var i int
  var buf int
  var res int
  fmt.Scanf("%d", &n)
  fmt.Scanln()
  fmt.Scanf("%d", &res)
  for i = 0; i < n; i++ {
    fmt.Scanf("%d", &buf)
    if buf%2 != res%2 {res = buf; break}
  }
  fmt.Println(res)
}

package main

import "fmt"

func main() {
  var n int
  var i int
  var buf int
  var ruf int
  var res int
  fmt.Scanf("%d", &n)
  fmt.Scanln()
  fmt.Scanf("%d", &ruf)
  res = 1
  for i = 0; i < n-1; i++ {
    fmt.Scanf("%d", &buf)
    // fmt.Println("buf----", buf, "----ruf----",ruf, "----i----", i)
    if buf%2 != ruf%2 {res = i+2; break}
  }
  fmt.Println(res)
}

package main

import(
	"fmt"
)

func main() {

	n := 0
	fmt.Scanf("%d\n", &n)
	arr := []int{}
	tmp := 0
	sum := 0

	for i := 0; i < n; i++ {
		fmt.Scanf("%d",&tmp)
		sum += tmp
		arr = append(arr, tmp)
	}

	for i := 0; i < n; i++ {
		if ((sum - arr[i]) % (n - 1)) == 0 {
			fmt.Println(i + 1)
		}
	}
}

package main

import "fmt"

func main() {
	var n, a, b int
	var x [100]int

	fmt.Scanf("%d", &n)
	for i := 0; i < n+1; i++ {
		fmt.Scanf("%d", &x[i])
	}

	ch := 0
	nch := 0

	for i := 0; i < n; i++ {
		if x[i]%2 == 0 {
			ch++
			a = i
		} else {
			nch++
			b = i
		}
	}

	if ch > nch {
		fmt.Println(b)
	} else {
		fmt.Println(a)
	}

}

package main

import "fmt"

func main() {
	var n, a, b int
	var x [100]int

	fmt.Scanf("%d", &n)
	for i := 1; i < n; i++ {
		fmt.Scanf("%d", &x[i])
	}

	ch :=0
	nch :=0
	for i:= 0; i < n; i++{
		if x[i] % 2 == 0 {
			ch++
			a = i + 1
		}else{
			nch++
			b = i + 1
		}
	}

	if ch > nch{
		fmt.Println(b)
	}else if nch > ch{
		fmt.Println(a)
	}
}

package main

import "fmt"

func main() {
	var n, a, b int
	var x [100]int

	fmt.Scanf("%d", &n)
	for i := 1; i <= n; i++ {
		fmt.Scanf("%d", &x[i])
	}

	ch :=0
	nch :=0
	for i:= 0; i < n; i++{
		if x[i] % 2 == 0 {
			ch++
			a = i + 1
		}else{
			nch++
			b = i + 1
		}
	}

	if ch > nch{
		fmt.Println(b)
	}else if nch > ch{
		fmt.Println(a)
	}

}

package main

import "fmt"

func main() {
	var n, a, b int
	var x [100]int

	fmt.Scanf("%d", &n)
	for i := 0; i < n + 1; i++ {
		fmt.Scanf("%d", &x[i])
	}

	ch :=0
	nch :=0

	for i:=0; i < n; i++{
		if x[i] % 2 == 0 {
			ch++
			a = i
		}else{
			nch++
			b = i
		}
	}

	if ch > nch{
		fmt.Println("b = ", b)
	}else{
		fmt.Println("a = ", a)
	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader

func init() {
	stdin := os.Stdin
	// stdin, _ = os.Open("1.in")
	reader = bufio.NewReaderSize(stdin, 1<<20)
}

func read() (n int) {
	var c byte
	fmt.Fscanf(reader, "%d%c", &n, &c)
	fmt.Println(n, c)
	return
}

var n int
var a []int

func main() {
	n = read()
	a = make([]int, n)

	var odd, even, oddSum, evenSum int
	for i := 0; i < n; i++ {
		a[i] = read()
		if a[i]%2 == 1 {
			oddSum++
			odd = i + 1
		} else {
			evenSum++
			even = i + 1
		}
	}

	if oddSum == 1 {
		fmt.Println(odd)
	} else {
		fmt.Println(even)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader

func init() {
	stdin := os.Stdin
	stdin, _ = os.Open("1.in")
	reader = bufio.NewReaderSize(stdin, 1<<20)
}

func read() (n int) {
	fmt.Fscan(reader, &n)
	return
}

var n int
var a []int

func main() {
	n = read()
	a = make([]int, n)

	var odd, even, oddSum, evenSum int
	for i := 0; i < n; i++ {
		a[i] = read()
		if a[i]%2 == 1 {
			oddSum++
			odd = i + 1
		} else {
			evenSum++
			even = i + 1
		}
	}

	if oddSum == 1 {
		fmt.Println(odd)
	} else {
		fmt.Println(even)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader

func init() {
	stdin := os.Stdin
	// stdin, _ = os.Open("1.in")
	reader = bufio.NewReaderSize(stdin, 1<<20)
}

func read() (n int) {
	fmt.Fscanf(reader, "%d", &n)
	var c byte
	fmt.Fscanf(reader, "%c", &c)
	return
}

var n int
var a []int

func main() {
	n = read()
	a = make([]int, n)

	var odd, even, oddSum, evenSum int
	for i := 0; i < n; i++ {
		a[i] = read()
		if a[i]%2 == 1 {
			oddSum++
			odd = i + 1
		} else {
			evenSum++
			even = i + 1
		}
	}

	if oddSum == 1 {
		fmt.Println(odd)
	} else {
		fmt.Println(even)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader

func init() {
	stdin := os.Stdin
	// stdin, _ = os.Open("1.in")
	reader = bufio.NewReaderSize(stdin, 1<<20)
}

func read() (n int) {
	var c rune
	fmt.Fscanf(reader, "%d%c", &n, &c)
	return
}

var n int
var a []int

func main() {
	n = read()
	a = make([]int, n)

	var odd, even, oddSum, evenSum int
	for i := 0; i < n; i++ {
		a[i] = read()
		if a[i]%2 == 1 {
			oddSum++
			odd = i + 1
		} else {
			evenSum++
			even = i + 1
		}
	}

	if oddSum == 1 {
		fmt.Println(odd)
	} else {
		fmt.Println(even)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader

func init() {
	stdin := os.Stdin
	// stdin, _ = os.Open("1.in")
	reader = bufio.NewReaderSize(stdin, 1<<20)
}

func read() (n int) {
	var c byte
	fmt.Fscanf(reader, "%d%c", &n, &c)
	return
}

var n int
var a []int

func main() {
	n = read()
	a = make([]int, n)

	var odd, even, oddSum, evenSum int
	for i := 0; i < n; i++ {
		a[i] = read()
		if a[i]%2 == 1 {
			oddSum++
			odd = i + 1
		} else {
			evenSum++
			even = i + 1
		}
	}

	if oddSum == 1 {
		fmt.Println(odd)
	} else {
		fmt.Println(even)
	}
}

package main

import "fmt"

func main() {
	length := 0
	fmt.Scanln(&length)
	numbers := make([]int, length)
	for i := 0; i < length; i++ {
		fmt.Scanf("%d",&numbers[i])
	}
	fmt.Println(numbers)

	var even,odd,ans1,ans2 int
	for i:=0;i<length;i++{
		if(numbers[i]%2==0){
			even++
			ans1=i+1
		}else {
			odd++
			ans2 =i+1
		}

	}
	if even>odd{
		fmt.Printf("%d",ans2)
	}else{
		fmt.Printf("%d",ans1)
	}

}

package main
import (
	 "fmt"
)

func main() {
	 var n int

	 var odd []int
	 var even []int
	 fmt.Scanf("%d", &n)

	 for i:=0; i<n; i ++ {
	 	   var x int
	 	   fmt.Scanf("%d", &x)
	 	   if x % 2 == 0 {
	 	   		odd = append(odd, x)
	 	   } else {
	 	   	    even = append(even, x)
	 	   }
	 }

	 if len(odd) == 1 {
	 	  fmt.Printf("%d", odd[0])
	 } else {
	 	  fmt.Printf("%d", even[0])
	 }
}

package main
import (
	 "fmt"
)

func main() {
	 var n int

	 var odd []int
	 var even []int
	 fmt.Scanf("%d", &n)

	 for i:=0; i<n; i ++ {
	 	   var x int
	 	   fmt.Scanf("%d", &x)

	 	   if x % 2 == 0 {
	 	   		odd = append(odd, i)
	 	   } else {
	 	   	    even = append(even, i)
	 	   }
	 }

	 if len(odd) == 1 {
	 	  fmt.Printf("%d", odd[0])
	 } else {
	 	  fmt.Printf("%d", even[0])
	 }
}

package main

import "fmt"

func main() {
	var t, s1, s2, a int
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		if s1 == 2 {
			fmt.Println(i)
		} else if s2 == 2 {
			fmt.Println(i)
		}
		fmt.Scanf("%d ", &a)
		if a%2 == 0 {
			s1++
		} else {
			s2++
		}
	}
}

package main

import "fmt"

func main() {
	var t, s1, s2, a int
	fmt.Scanf("%d\n", &t)
	for i := 0; i <= t; i++ {
		if s1 == 2 {
			fmt.Println(i)
		} else if s2 == 2 {
			fmt.Println(i)
		}
		fmt.Scanf("%d ", &a)
		if a%2 == 0 {
			s1++
		} else {
			s2++
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	var line string
	var arrS []string
	var tmp, lchet, lnehet, summchet, summnechet int
	var flagchet, flagnechet bool
	reader := bufio.NewReader(os.Stdin)
	line, _ = reader.ReadString('\n')
	line, _ = reader.ReadString('\n')
	arrS = strings.Split(strings.TrimSpace(line), " ")
	for j := range arrS {
		tmp, _ = strconv.Atoi(arrS[j])
		if tmp%2 == 0 {
			lchet = j + 1
			summchet++
			flagchet = true
			if summchet >= 2 && flagnechet {
				fmt.Println(lnehet)
				os.Exit(0)
			}
		} else {
			lnehet = j + 1
			summnechet++
			flagnechet = true
			if summnechet >= 2 && flagchet {
				fmt.Println(lchet)
				os.Exit(0)
			}
		}
	}
}

package main

import "fmt"

func main() {

	var n int
	fmt.Scanln(&n)
	var tem int
	var f0 int = 0 // 上上次
	var f1 int = 0 // 上一个
	var f2 int = 0 // 当前
	var arr [100]int

	for i := 0; i < n; i++ {
		fmt.Scan(&tem)
		arr[i] = tem
	}

	f0 = check(arr[0]) //上上个
	f1 = check(arr[1])
	f2 = check(arr[2])
	if f0 == f1 && f1 == f2 && f2 == f0 {

	} else {
		if f0 == f1 {
			fmt.Println(3)
			return
		}
		if f0 == f2 {
			fmt.Println(2)
			return
		}
		if f1 == f2 {
			fmt.Println(0)
			return
		}
	}
	for i := 3; i < n; i++ {
		f0 = f1
		f1 = f2
		f2 = check(arr[i])
		if f2 != f1 {
			fmt.Println(i + 1)
			return
		}

	}

}

func check(i int) int {

	if i%2 == 0 {
		return 0
	} else {
		return 1
	}

}

package main

import "fmt"

func main() {

	var n int
	fmt.Scanln(&n)
	var tem int
	var f0 int = 0 // 上上次
	var f1 int = 0 // 上一个
	var f2 int = 0 // 当前
	f0 = f0
	var arr [100]int

	for i := 0; i < n; i++ {
		fmt.Scanln(&tem)
		arr[i] = tem
	}
	fmt.Println(arr[0], arr[1], arr[2], arr[3])
	f0 = check(arr[0]) //上上个
	f1 = check(arr[1])
	f2 = check(arr[2])

	if f0 == f1 && f1 == f2 && f2 == f0 {

	} else {
		if f0 == f1 {
			fmt.Println(3)
			return
		}
		if f0 == f2 {
			fmt.Println(2)
			return
		}
		if f1 == f2 {
			fmt.Println(0)
			return
		}
	}

	for i := 3; i < n; i++ {

		f0 = f1
		f1 = f2
		f2 = check(arr[i])
		if f2 != f1 {
			fmt.Println(i + 1)
			return
		}

	}

}

func check(i int) int {

	if i%2 == 0 {
		return 0
	} else {
		return 1
	}

}

package main

import "fmt"

func main() {
	var n, a int
	var fo, fe int
	var ec, oc int
	fmt.Scanf("%d", &n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a)
		if a%2 == 0 {
			if ec == 0 {
				fe = i
			}
			ec++
		} else {
			if oc == 0 {
				fo = i
			}
		}
	}
	if ec == 1 {
		fmt.Println(fe + 1)
	} else {
		fmt.Println(fo + 1)
	}
}

package main

import "fmt"

func main() {
	var n, a int
	var fo, fe int
	var ec, oc int
	fe = 0
	fo = 0
	ec = 0
	oc = 0
	fmt.Scanf("%d", &n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a)
		if a%2 == 0 {
			if ec == 0 {
				fe = i + 1
			}
			ec++
		} else {
			if oc == 0 {
				fo = i + 1
			}
			oc++
		}
	}
	if ec == 1 {
		fmt.Println(fe)
	} else {
		fmt.Println(fo)
	}
}

package main

import "fmt"

func main() {
	var n, a int
	var fo, fe int
	var ec, oc int
	fe = 0
	fo = 0
	ec = 0
	oc = 0
	fmt.Scanf("%d", &n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a)
		if a%2 == 0 {
			if ec == 0 {
				fe = i
			}
			ec++
		} else {
			if oc == 0 {
				fo = i
			}
			oc++
		}
	}
	if ec == 1 {
		fmt.Println(fe + 1)
	} else {
		fmt.Println(fo + 1)
	}
}

package main

import "fmt"

func main() {
	var n, a int
	var fo, fe int
	var ec, oc int
	fmt.Scanf("%d", &n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a)
		if a%2 == 0 {
			if ec == 0 {
				fe = i
			}
			ec++
		} else {
			if oc == 0 {
				fo = i
			}
			oc++
		}
	}
	if ec == 1 {
		fmt.Println(fe + 1)
	} else {
		fmt.Println(fo + 1)
	}
}

package main

import (
    "fmt"
)

func main() {
    n := 0;
    fmt.Scanf("%d", &n);
    a := make([]int, n);
    for i := 0; i < n; i++ {
        fmt.Scanf("%d", &a[i]);
    }

    count := 0;
    for i, v := range(a) {
        a[i] = v % 2;
        count += a[i];
    }

    x := 1;

    if (count >= 2) {
        x = 0;
    }

    for i := 0; i < len(a); i++ {
        if a[i] == x {
            fmt.Printf("%d\n", i + 1);
            break;
        }
    }

}

package main

import (
    "fmt"
)

func main() {
    n := 0;
    fmt.Scanf("%d", &n);
    a := make([]int, n);
    for i := 0; i < n; i++ {
        fmt.Scanf("%d", &a[i]);
    }

    count := 0;
    for i, v := range(a) {
        a[i] = v % 2;
        count += a[i];
    }

    x := 1;
    if (count >= 2) {
        x = 0;
    }
    for i := 0; i < count; i++ {
        if a[i] == x {
            fmt.Printf("%d\n", i + 1);
            break;
        }
    }

}


package main

import (
	"fmt"
)

var bytes []byte
var l, max int

func fastScan() int {
	b := bytes[l]

	// Check if the bytes is not a number
	for b < 48 || b > 57 {
		l++
		b = bytes[l]
	}

	result := 0
	for 47 < b && b < 58 {
		result = (result << 3) + (result << 1) + int(b-48)

		l++
		if l > max {
			return result
		}
		b = bytes[l]
	}
	return result
}

func main() {
	// fmt.Println("hello")
	// bytes, _ = ioutil.ReadAll(bufio.NewReader(os.Stdin))
	// max = len(bytes) - 1

	// ws := bufio.NewWriter(os.Stdout)
	var t int
	// t = fastScan()
	fmt.Scan(&t)
	var n int
	for j := 0; j < t; j++ {
		lst := []int{}
		// n = fastScan()
		fmt.Scan(&n)
		var x int
		for ele := 0; ele < n; ele++ {
			// x = fastScan()
			fmt.Scan(&x)
			lst = append(lst, x)
		}

		if n%2 == 1 {
			fmt.Println(-1)
		} else {
			ans := []int{}
			for i := 0; i < n-1; i += 2 {
				if lst[i] == lst[i+1] {
					ans = append(ans, i+1, i+2)
				} else {
					ans = append(ans, i+1, i+1, i+2, i+2)
				}
			}
			fmt.Println(len(ans) / 2)

			for i := 0; i < len(ans)-1; i += 2 {
				fmt.Println(ans[i], ans[i+1])
			}
		}

		// ws.Flush()

	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	r, w := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var epochs int
	fmt.Fscan(r, &epochs)
	for ; epochs > 0; epochs-- {
		var n, n1, n2 int
		fmt.Fscan(r, &n)

		if n&1 == 1 {
			for i := 0; i < n; i++ {
				fmt.Fscan(r, &n1)
			}
			fmt.Fprintln(w, "-1")
		} else {
			list := []int{}
			flag := 0
			for i := 1; i <= n; i += 2 {
				fmt.Fscan(r, &n1, &n2)
				if n1 == n2 {
					if flag == 1 {
						//list[len(list)-1] = i + 1
					} else {
						list = append(list, i)
					}
					flag = 1
				} else {
					list = append(list, i, i+1)
					flag = 0
				}
			}
			list = append(list, n+1)

			fmt.Fprintln(w, len(list)-1)
			for i := 0; i < len(list)-1; i++ {
				fmt.Fprintln(w, list[i], list[i+1]-1)
			}
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	r, w := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var epochs int
	fmt.Fscan(r, &epochs)
	for ; epochs > 0; epochs-- {
		var n, n1, n2 int
		fmt.Fscan(r, &n)

		if n&1 == 1 {
			for i := 0; i < n; i++ {
				fmt.Fscan(r, &n1)
			}
			fmt.Fprintln(w, "-1")
		} else {
			list := []int{}
			flag := 0
			for i := 1; i <= n; i += 2 {
				fmt.Fscan(r, &n1, &n2)
				if n1 == n2 {
					if flag == 1 {
						list[len(list)-1] = i + 1
					} else {
						list = append(list, i, i+1)
					}
					flag = 1
				} else {
					list = append(list, i, i, i+1, i+1)
					flag = 0
				}
			}

			fmt.Fprintln(w, len(list)>>1)
			for i := 0; i < len(list); i += 2 {
				fmt.Fprintln(w, list[i], list[i+1])
			}
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

var (
	reader = bufio.NewReader(os.Stdin)
	t, n   int
)

type Segment struct {
	begin int
	end   int
}

func solve(n int, a []int) string {
	if n%2 == 1 {
		return "-1"
	}
	var list = []Segment{}
	count := 0
	for i := 0; i < n; i += 2 {
		if a[i] == a[i+1] {
			if count == 0 {
				list = append(list, Segment{i, i + 1})
				count++
			} else {
				list[count-1].end = i + 1
			}
		} else {
			list = append(list, Segment{i, i}, Segment{i + 1, i + 1})
			count += 2
		}
	}
	var s []string
	for _, x := range list {
		s = append(s, fmt.Sprintf("%d %d", x.begin+1, x.end+1))
	}
	return fmt.Sprintf("%d\n", count) + strings.Join(s, "\n")
}

func main() {
	fmt.Fscan(reader, &t)
	for ; t > 0; t-- {
		fmt.Fscan(reader, &n)
		a := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(reader, &a[i])
		}
		fmt.Println(solve(n, a))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

var (
	reader = bufio.NewReader(os.Stdin)
	t, n   int
)

type Segment struct {
	begin int
	end   int
}

func (s Segment) String() string {
	return fmt.Sprintf("%d %d", s.begin+1, s.end+1)
}

func solve(n int, a []int) string {
	if n%2 == 1 {
		return "-1"
	}
	var list = []Segment{}
	count := 0
	for i := 0; i < n; i += 2 {
		if a[i] == a[i+1] {
			if count == 0 {
				list = append(list, Segment{i, i + 1})
				count++
			} else {
				list[count-1].end = i + 1
			}
		} else {
			list = append(list, Segment{i, i}, Segment{i + 1, i + 1})
			count += 2
		}
	}
	var s []string
	for _, x := range list {
		s = append(s, fmt.Sprint(x))
	}
	return fmt.Sprintf("%d\n", count) + strings.Join(s, "\n")
}

func main() {
	fmt.Fscan(reader, &t)
	for ; t > 0; t-- {
		fmt.Fscan(reader, &n)
		a := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(reader, &a[i])
		}
		fmt.Println(solve(n, a))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

const cf = true

type pair struct {
	begin int
	end   int
}

func solve() {
	var n int
	fmt.Fscan(in, &n)
	arr := make([]int, n)
	for i := range arr {
		fmt.Fscan(in, &arr[i])
	}
	if n%2 == 1 {
		fmt.Fprintln(out, -1)
		return
	}
	lines := make([]pair, 0, n)
	for i := 0; i < n-1; i += 2 {
		if arr[i] == arr[i+1] {
			lines = append(lines, pair{i + 1, i + 2})
		} else {
			lines = append(lines, pair{i + 1, i + 1})
			lines = append(lines, pair{i + 2, i + 2})
		}
	}
	fmt.Fprintln(out, len(lines))
	for _, line := range lines {
		fmt.Fprintln(out, line.begin, line.end)
	}
}

func main() {
	defer out.Flush()
	t := 1
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		solve()
	}
}

func LCM(a, b int) int {
	return a * b / GCD(a, b)
}

func GCD(a, b int) int {
	for a != b {
		if a > b {
			a -= b
		} else {
			b -= a
		}
	}

	return a
}

type SqrtInt interface {
	SignedSqrt | UnsignedSqrt
}

type SignedSqrt interface {
	~int | ~int32 | ~int64
}

type UnsignedSqrt interface {
	~uint | ~uint32 | ~uint64 | ~uintptr
}

func sqrt[T SqrtInt](x T) T {
	l, r := T(0), T(2000000123)
	for l < r {
		mid := (l + r) / 2
		if mid*mid > x {
			r = mid
		} else {
			l = mid + 1
		}
	}
	return l - 1
}

func ConvertInt(val string, base, toBase int) (string, error) {
	i, err := strconv.ParseInt(val, base, 64)
	if err != nil {
		return "", err
	}
	return strconv.FormatInt(i, toBase), nil
}

type set[T Ordered] struct {
	itms map[T]struct{}
}

func (s *set[T]) init() {
	if s.itms == nil {
		s.itms = make(map[T]struct{})
	}
}

func (s *set[T]) add(item T) *set[T] {
	s.init()
	s.itms[item] = exists
	return s
}

func (s *set[T]) remove(item T) *set[T] {
	s.init()
	delete(s.itms, item)
	return s
}

func (s *set[T]) has(item T) bool {
	s.init()
	_, c := s.itms[item]
	return c
}

func (s *set[T]) sortedItems() []T {
	s.init()
	items := make([]T, 0, s.size())
	for item := range s.itms {
		items = append(items, item)
	}
	sort.Slice(items, func(i, j int) bool {
		return items[i] < items[j]
	})
	return items
}

func (s *set[T]) items() []T {
	s.init()
	items := make([]T, 0, s.size())
	for item := range s.itms {
		items = append(items, item)
	}
	return items
}

func (s *set[T]) size() int {
	s.init()
	return len(s.itms)
}

var exists = struct{}{}

const MaxUint = ^uint(0)
const MinUint = 0
const MaxInt = int(MaxUint >> 1)
const MinInt = -MaxInt - 1

func reverseStr(s string) string {
	r := []byte(s)
	for i, j := 0, len(r)-1; i < len(r)/2; i, j = i+1, j-1 {
		r[i], r[j] = r[j], r[i]
	}
	return string(r)
}

type Float interface {
	~float32 | ~float64
}

type Integer interface {
	Signed | Unsigned
}

type Signed interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64
}

type Unsigned interface {
	~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
}

type Ordered interface {
	Integer | Float | ~string
}

func abs[T Signed](x T) T {
	if x < 0 {
		return -x
	}
	return x
}

func min[T Ordered](x, y T) T {
	if x < y {
		return x
	}
	return y
}

func max[T Ordered](x, y T) T {
	if x > y {
		return x
	}
	return y
}

var (
	in  = getReader()
	out = getWriter()
)

func getReader() *bufio.Reader {
	if cf {
		return bufio.NewReader(os.Stdin)
	} else {
		in, _ := os.Open("input.txt")
		return bufio.NewReader(in)
	}
}

func getWriter() *bufio.Writer {
	if cf {
		return bufio.NewWriter(os.Stdout)
	} else {
		out, _ := os.Create("output.txt")
		return bufio.NewWriter(out)
	}
}

package main

import (
	."fmt"
	."os"
)

func solve(){
	var n int
	Fscan(Stdin, &n)
	sz := make([]int, n)
	for i := 0; i < n; i++ {
		Fscan(Stdin, &sz[i])
	}
	tot := 0
	last := 0
	break_arr := make([]int, n)
	for i := 0; i < n; i++{
		if last == 0{
			last = sz[i]
			tot = sz[i]
		}else{
			if sz[i] == last{
				if tot == 0{
					tot = sz[i]
				}else{
					tot = 0
				}
			}else{
				if tot == 0{
					break_arr[i - 1] = 1
					tot = sz[i]
					last = sz[i]
				}else{
					break_arr[i - 1] = 1
					break_arr[i] = 1
					tot = 0
					last = 0
				}
			}
		}
		// Fprintln(Stdout, "tot = ", tot)
	}
	// for i := 0; i < n; i ++{
	// 	Fprintln(Stdout, break_arr[i])
	// }
	if tot == 0{
		break_arr[n - 1] = 1
		out_n := 0
		for i := 0; i < n; i++{
			if break_arr[i] == 1{
				out_n ++
			}
		}
		Fprintln(Stdout, out_n)
		l := 1
		for i := 0; i < n; i++{
			if break_arr[i] == 1{
				Fprintln(Stdout, l, i + 1)
				l = i + 2
			}
		}
	}else{
		Fprintln(Stdout, -1)
	}
}

func main(){
	var t int
	Fscan(Stdin, &t)
	for ; t > 0; t--{
		solve()
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

type seg struct {
	l int
	r int
}

func main() {
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var T int
	for fmt.Fscan(r, &T); T > 0; T-- {

		var n, rsum int
		fmt.Fscan(r, &n)
		a := make([]int, n)

		for i := range a {
			fmt.Fscan(r, &a[i])
			rsum += (2 + a[i]) % 2
		}

		if rsum % 2 == 1 {
			fmt.Fprintln(w, -1)
		} else {
			segc := 0
			segs := make([]seg, n)
			for j := 0; j < n; j += 2 {
				if a[j] == a[j+1] {
					segs[segc] = seg{j+1, j+2}
					segc++
				} else {
					segs[segc] = seg{j+1, j+1}
					segs[segc+1] = seg{j+2, j+2}
					segc += 2
				}
			}

			fmt.Fprintln(w, segc)
			for j := 0; j < segc; j++ {
				fmt.Fprintln(w, segs[j].l, segs[j].r)
			}
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func integer_list(s string, sep string) []int {
	lst := strings.Split(s, sep)
	return conv(lst)
}

func conv(lst []string) []int {

	ret := []int{}
	for _, val := range lst {
		x, _ := strconv.Atoi(val)
		ret = append(ret, x)
	}
	return ret

}

func main() {
	// fmt.Println("hello")

	reader := bufio.NewReader(os.Stdin)
	line, _ := reader.ReadString('\n')
	t, _ := strconv.Atoi(line[0 : len(line)-2])

	for j := 0; j < t; j++ {
		line, _ := reader.ReadString('\n')
		n, _ := strconv.Atoi(line[0 : len(line)-2])
		str, _ := reader.ReadString('\n')
		lst := integer_list(str[0:len(str)-2], " ")
		// fmt.Println(lst, line, str, t, "prikdf")
		if n%2 == 1 {
			fmt.Println(-1)
		} else {
			ans := []int{}
			for i := 0; i < n-1; i += 2 {
				if lst[i] == lst[i+1] {
					ans = append(ans, i+1, i+2)
				} else {
					ans = append(ans, i+1, i+1, i+2, i+2)
				}
			}
			fmt.Println(len(ans) / 2)

			for i := 0; i < len(ans)-1; i += 2 {
				fmt.Println(ans[i], ans[i+1])
			}
		}

		// ws.Flush()

	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscan(reader, f) }
func main() {
	// fmt.Println("hello")
	// defer writer.Flush()
	var t int
	// fmt.Println("hello")
	fmt.Scan(&t)
	fmt.Println(t, "t")
	var n int
	for j := 0; j < t; j++ {
		scanf("%d\r\n", &n)
		var x int
		lst := []int{}
		for k := 0; k < n-1; j++ {
			scanf("%d", &x)
			lst = append(lst)

		}
		fmt.Println(lst, n)
		// fmt.Println(lst, line, str, t, "prikdf")
		if n%2 == 1 {
			fmt.Println(-1)
		} else {
			ans := []int{}
			for i := 0; i < n-1; i += 2 {
				if lst[i] == lst[i+1] {
					ans = append(ans, i+1, i+2)
				} else {
					ans = append(ans, i+1, i+1, i+2, i+2)
				}
			}
			fmt.Println(len(ans) / 2)

			for i := 0; i < len(ans)-1; i += 2 {
				fmt.Println(ans[i], ans[i+1])
			}
		}

		// ws.Flush()

	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscan(reader, f) }
func main() {
	// fmt.Println("hello")
	// defer writer.Flush()
	var t int
	// fmt.Println("hello")
	fmt.Scan(&t)
	fmt.Println(t, "t")
	var n int
	for j := 0; j < t; j++ {
		scanf("%d\r\n", &n)
		var x int
		lst := []int{}
		for k := 0; k < n-1; j++ {
			scanf("%d", &x)
			lst = append(lst)

		}
		fmt.Println(lst)
		// fmt.Println(lst, line, str, t, "prikdf")
		if n%2 == 1 {
			fmt.Println(-1)
		} else {
			ans := []int{}
			for i := 0; i < n-1; i += 2 {
				if lst[i] == lst[i+1] {
					ans = append(ans, i+1, i+2)
				} else {
					ans = append(ans, i+1, i+1, i+2, i+2)
				}
			}
			fmt.Println(len(ans) / 2)

			for i := 0; i < len(ans)-1; i += 2 {
				fmt.Println(ans[i], ans[i+1])
			}
		}

		// ws.Flush()

	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscan(reader, f) }
func main() {
	// fmt.Println("hello")
	// defer writer.Flush()
	var t int
	// fmt.Println("hello")
	scanf("%d\r\n", &t)
	fmt.Println(t, "t")
	var n int
	for j := 0; j < t; j++ {
		scanf("%d\r\n", &n)
		var x int
		lst := []int{}
		for k := 0; k < n; j++ {
			scanf("%d", &x)
			lst = append(lst)

		}
		fmt.Println(lst)
		// fmt.Println(lst, line, str, t, "prikdf")
		if n%2 == 1 {
			fmt.Println(-1)
		} else {
			ans := []int{}
			for i := 0; i < n-1; i += 2 {
				if lst[i] == lst[i+1] {
					ans = append(ans, i+1, i+2)
				} else {
					ans = append(ans, i+1, i+1, i+2, i+2)
				}
			}
			fmt.Println(len(ans) / 2)

			for i := 0; i < len(ans)-1; i += 2 {
				fmt.Println(ans[i], ans[i+1])
			}
		}

		// ws.Flush()

	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscan(reader, f) }
func main() {
	// fmt.Println("hello")
	// defer writer.Flush()
	var t int
	// fmt.Println("hello")
	scanf("%d\r", &t)
	fmt.Println(t, "t")
	var n int
	for j := 0; j < t; j++ {
		scanf("%d", &n)
		var x int
		lst := []int{}
		for j := 0; j < n; j++ {
			scanf("%d", &x)
			lst = append(lst)

		}
		fmt.Println(lst)
		// fmt.Println(lst, line, str, t, "prikdf")
		if n%2 == 1 {
			fmt.Println(-1)
		} else {
			ans := []int{}
			for i := 0; i < n-1; i += 2 {
				if lst[i] == lst[i+1] {
					ans = append(ans, i+1, i+2)
				} else {
					ans = append(ans, i+1, i+1, i+2, i+2)
				}
			}
			fmt.Println(len(ans) / 2)

			for i := 0; i < len(ans)-1; i += 2 {
				fmt.Println(ans[i], ans[i+1])
			}
		}

		// ws.Flush()

	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscan(reader, f) }
func main() {
	// fmt.Println("hello")
	// defer writer.Flush()
	var t int
	fmt.Println("hello")
	scanf("%d\r", &t)
	fmt.Println(t, "t")
	var n int
	for j := 0; j < t; j++ {
		scanf("%d", &n)
		var x int
		lst := []int{}
		for j := 0; j < n; j++ {
			scanf("%d", &x)
			lst = append(lst)

		}
		fmt.Println(lst)
		// fmt.Println(lst, line, str, t, "prikdf")
		if n%2 == 1 {
			fmt.Println(-1)
		} else {
			ans := []int{}
			for i := 0; i < n-1; i += 2 {
				if lst[i] == lst[i+1] {
					ans = append(ans, i+1, i+2)
				} else {
					ans = append(ans, i+1, i+1, i+2, i+2)
				}
			}
			fmt.Println(len(ans) / 2)

			for i := 0; i < len(ans)-1; i += 2 {
				fmt.Println(ans[i], ans[i+1])
			}
		}

		// ws.Flush()

	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscan(reader, f) }
func main() {
	// fmt.Println("hello")
	// defer writer.Flush()
	var t int
	fmt.Println("hello")
	scanf("%d", &t)
	fmt.Println(t, "t")
	var n int
	for j := 0; j < t; j++ {
		scanf("%d", &n)
		var x int
		lst := []int{}
		for j := 0; j < n; j++ {
			scanf("%d", &x)
			lst = append(lst)

		}
		fmt.Println(lst)
		// fmt.Println(lst, line, str, t, "prikdf")
		if n%2 == 1 {
			fmt.Println(-1)
		} else {
			ans := []int{}
			for i := 0; i < n-1; i += 2 {
				if lst[i] == lst[i+1] {
					ans = append(ans, i+1, i+2)
				} else {
					ans = append(ans, i+1, i+1, i+2, i+2)
				}
			}
			fmt.Println(len(ans) / 2)

			for i := 0; i < len(ans)-1; i += 2 {
				fmt.Println(ans[i], ans[i+1])
			}
		}

		// ws.Flush()

	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscan(reader, f) }
func main() {
	// fmt.Println("hello")
	// defer writer.Flush()
	var t int
	scanf("%d", &t)
	fmt.Println(t, "t")
	var n int
	for j := 0; j < t; j++ {
		scanf("%d", &n)
		var x int
		lst := []int{}
		for j := 0; j < n; j++ {
			scanf("%d", &x)
			lst = append(lst)

		}
		fmt.Println(lst)
		// fmt.Println(lst, line, str, t, "prikdf")
		if n%2 == 1 {
			fmt.Println(-1)
		} else {
			ans := []int{}
			for i := 0; i < n-1; i += 2 {
				if lst[i] == lst[i+1] {
					ans = append(ans, i+1, i+2)
				} else {
					ans = append(ans, i+1, i+1, i+2, i+2)
				}
			}
			fmt.Println(len(ans) / 2)

			for i := 0; i < len(ans)-1; i += 2 {
				fmt.Println(ans[i], ans[i+1])
			}
		}

		// ws.Flush()

	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscan(reader, f) }
func main() {
	// fmt.Println("hello")
	// defer writer.Flush()
	var t int
	scanf("%d\n", &t)
	fmt.Println(t, "t")
	var n int
	for j := 0; j < t; j++ {
		scanf("%d\n", &n)
		var x int
		lst := []int{}
		for j := 0; j < n; j++ {
			scanf("%d ", &x)
			lst = append(lst)

		}
		fmt.Println(lst)
		// fmt.Println(lst, line, str, t, "prikdf")
		if n%2 == 1 {
			fmt.Println(-1)
		} else {
			ans := []int{}
			for i := 0; i < n-1; i += 2 {
				if lst[i] == lst[i+1] {
					ans = append(ans, i+1, i+2)
				} else {
					ans = append(ans, i+1, i+1, i+2, i+2)
				}
			}
			fmt.Println(len(ans) / 2)

			for i := 0; i < len(ans)-1; i += 2 {
				fmt.Println(ans[i], ans[i+1])
			}
		}

		// ws.Flush()

	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscan(reader, f) }
func main() {
	// fmt.Println("hello")
	defer writer.Flush()
	var t int
	scanf("%d\n", &t)
	var n int
	for j := 0; j < t; j++ {
		scanf("%d\n", &n)
		var x int
		lst := []int{}
		for j := 0; j < n; j++ {
			scanf("%d ", &x)
			lst = append(lst)

		}
		// fmt.Println(lst, line, str, t, "prikdf")
		if n%2 == 1 {
			fmt.Println(-1)
		} else {
			ans := []int{}
			for i := 0; i < n-1; i += 2 {
				if lst[i] == lst[i+1] {
					ans = append(ans, i+1, i+2)
				} else {
					ans = append(ans, i+1, i+1, i+2, i+2)
				}
			}
			fmt.Println(len(ans) / 2)

			for i := 0; i < len(ans)-1; i += 2 {
				fmt.Println(ans[i], ans[i+1])
			}
		}

		// ws.Flush()

	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscan(reader, f) }
func main() {
	// fmt.Println("hello")
	defer writer.Flush()
	var t int
	scanf("%d\n", &t)
	fmt.Println(t, "t")
	var n int
	for j := 0; j < t; j++ {
		scanf("%d\n", &n)
		var x int
		lst := []int{}
		for j := 0; j < n; j++ {
			scanf("%d ", &x)
			lst = append(lst)

		}
		// fmt.Println(lst, line, str, t, "prikdf")
		if n%2 == 1 {
			fmt.Println(-1)
		} else {
			ans := []int{}
			for i := 0; i < n-1; i += 2 {
				if lst[i] == lst[i+1] {
					ans = append(ans, i+1, i+2)
				} else {
					ans = append(ans, i+1, i+1, i+2, i+2)
				}
			}
			fmt.Println(len(ans) / 2)

			for i := 0; i < len(ans)-1; i += 2 {
				fmt.Println(ans[i], ans[i+1])
			}
		}

		// ws.Flush()

	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func integer_list(s string, sep string) []int {
	lst := strings.Split(s, sep)
	return conv(lst)
}

func conv(lst []string) []int {

	ret := []int{}
	for _, val := range lst {
		x, _ := strconv.Atoi(val)
		ret = append(ret, x)
	}
	return ret

}

func main() {
	// fmt.Println("hello")

	reader := bufio.NewReader(os.Stdin)
	line, _ := reader.ReadString('\n')
	t, _ := strconv.Atoi(line[0 : len(line)-2])

	for j := 0; j < t; j++ {
		line, _ := reader.ReadString('\n')
		n, _ := strconv.Atoi(line[0 : len(line)-2])
		str, _ := reader.ReadString('\n')
		lst := integer_list(str[0:len(str)-2], " ")
		fmt.Println(lst, line, str, t, "prikdf")
		if n%2 == 1 {
			fmt.Println(-1)
		} else {
			ans := []int{}
			for i := 0; i < n-1; i += 2 {
				if lst[i] == lst[i+1] {
					ans = append(ans, i+1, i+2)
				} else {
					ans = append(ans, i+1, i+1, i+2, i+2)
				}
			}
			fmt.Println(len(ans) / 2)

			for i := 0; i < len(ans)-1; i += 2 {
				fmt.Println(ans[i], ans[i+1])
			}
		}

		// ws.Flush()

	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func integer_list(s string, sep string) []int {
	lst := strings.Split(s, sep)
	return conv(lst)
}

func conv(lst []string) []int {

	ret := []int{}
	for _, val := range lst {
		x, _ := strconv.Atoi(val)
		ret = append(ret, x)
	}
	return ret

}

func main() {
	// fmt.Println("hello")

	reader := bufio.NewReader(os.Stdin)
	line, _ := reader.ReadString('\r')
	t, errr := strconv.Atoi(line)
	fmt.Println(errr)
	for j := 0; j < t; j++ {
		line, _ := reader.ReadString('\r')
		n, _ := strconv.Atoi(line)
		str, _ := reader.ReadString('\n')
		lst := integer_list(str, " ")
		fmt.Print(lst)
		if n%2 == 1 {
			fmt.Println(-1)
		} else {
			ans := []int{}
			for i := 0; i < n-1; i += 2 {
				if lst[i] == lst[i+1] {
					ans = append(ans, i+1, i+2)
				} else {
					ans = append(ans, i+1, i+1, i+2, i+2)
				}
			}
			fmt.Println(len(ans) / 2)

			for i := 0; i < len(ans)-1; i += 2 {
				fmt.Println(ans[i], ans[i+1])
			}
		}

		// ws.Flush()

	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func integer_list(s string, sep string) []int {
	lst := strings.Split(s, sep)
	return conv(lst)
}

func conv(lst []string) []int {

	ret := []int{}
	for _, val := range lst {
		x, _ := strconv.Atoi(val)
		ret = append(ret, x)
	}
	return ret

}

func main() {
	// fmt.Println("hello")

	reader := bufio.NewReader(os.Stdin)
	line, _ := reader.ReadString('\r')
	t, errr := strconv.Atoi(line)
	fmt.Println(errr)
	for j := 0; j < t; j++ {
		line, _ := reader.ReadString('\n')
		n, _ := strconv.Atoi(line)
		str, _ := reader.ReadString('\n')
		lst := integer_list(str, " ")
		fmt.Print(lst)
		if n%2 == 1 {
			fmt.Println(-1)
		} else {
			ans := []int{}
			for i := 0; i < n-1; i += 2 {
				if lst[i] == lst[i+1] {
					ans = append(ans, i+1, i+2)
				} else {
					ans = append(ans, i+1, i+1, i+2, i+2)
				}
			}
			fmt.Println(len(ans) / 2)

			for i := 0; i < len(ans)-1; i += 2 {
				fmt.Println(ans[i], ans[i+1])
			}
		}

		// ws.Flush()

	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func integer_list(s string, sep string) []int {
	lst := strings.Split(s, sep)
	return conv(lst)
}

func conv(lst []string) []int {

	ret := []int{}
	for _, val := range lst {
		x, _ := strconv.Atoi(val)
		ret = append(ret, x)
	}
	return ret

}

func main() {
	// fmt.Println("hello")

	reader := bufio.NewReader(os.Stdin)
	line, _ := reader.ReadString('\r')
	t, err := strconv.Atoi(line)
	fmt.Println(err)
	for j := 0; j < t; j++ {
		line, _ := reader.ReadString('\n')
		n, _ := strconv.Atoi(line)
		str, _ := reader.ReadString('\n')
		lst := integer_list(str, " ")
		fmt.Print(lst)
		if n%2 == 1 {
			fmt.Println(-1)
		} else {
			ans := []int{}
			for i := 0; i < n-1; i += 2 {
				if lst[i] == lst[i+1] {
					ans = append(ans, i+1, i+2)
				} else {
					ans = append(ans, i+1, i+1, i+2, i+2)
				}
			}
			fmt.Println(len(ans) / 2)

			for i := 0; i < len(ans)-1; i += 2 {
				fmt.Println(ans[i], ans[i+1])
			}
		}

		// ws.Flush()

	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func integer_list(s string, sep string) []int {
	lst := strings.Split(s, sep)
	return conv(lst)
}

func conv(lst []string) []int {

	ret := []int{}
	for _, val := range lst {
		x, _ := strconv.Atoi(val)
		ret = append(ret, x)
	}
	return ret

}

func main() {
	// fmt.Println("hello")

	reader := bufio.NewReader(os.Stdin)
	line, _ := reader.ReadString('\n')
	t, err := strconv.Atoi(line)
	fmt.Println(err)
	for j := 0; j < t; j++ {
		line, _ := reader.ReadString('\n')
		n, _ := strconv.Atoi(line)
		str, _ := reader.ReadString('\n')
		lst := integer_list(str, " ")
		fmt.Print(lst)
		if n%2 == 1 {
			fmt.Println(-1)
		} else {
			ans := []int{}
			for i := 0; i < n-1; i += 2 {
				if lst[i] == lst[i+1] {
					ans = append(ans, i+1, i+2)
				} else {
					ans = append(ans, i+1, i+1, i+2, i+2)
				}
			}
			fmt.Println(len(ans) / 2)

			for i := 0; i < len(ans)-1; i += 2 {
				fmt.Println(ans[i], ans[i+1])
			}
		}

		// ws.Flush()

	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func integer_list(s string, sep string) []int {
	lst := strings.Split(s, sep)
	return conv(lst)
}

func conv(lst []string) []int {

	ret := []int{}
	for _, val := range lst {
		x, _ := strconv.Atoi(val)
		ret = append(ret, x)
	}
	return ret

}

func main() {
	// fmt.Println("hello")

	reader := bufio.NewReader(os.Stdin)
	line, _ := reader.ReadString('\n')
	t, _ := strconv.Atoi(line)

	for j := 0; j < t; j++ {
		line, _ := reader.ReadString('\n')
		n, _ := strconv.Atoi(line)
		str, _ := reader.ReadString('\n')
		lst := integer_list(str, " ")

		if n%2 == 1 {
			fmt.Println(-1)
		} else {
			ans := []int{}
			for i := 0; i < n-1; i += 2 {
				if lst[i] == lst[i+1] {
					ans = append(ans, i+1, i+2)
				} else {
					ans = append(ans, i+1, i+1, i+2, i+2)
				}
			}
			fmt.Println(len(ans) / 2)

			for i := 0; i < len(ans)-1; i += 2 {
				fmt.Println(ans[i], ans[i+1])
			}
		}

		// ws.Flush()

	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func integer_list(s string, sep string) []int {
	lst := strings.Split(s, sep)
	return conv(lst)
}

func conv(lst []string) []int {

	ret := []int{}
	for _, val := range lst {
		x, _ := strconv.Atoi(val)
		ret = append(ret, x)
	}
	return ret

}

func main() {
	// fmt.Println("hello")

	reader := bufio.NewReader(os.Stdin)
	line, _ := reader.ReadString('\n')
	t, _ := strconv.Atoi(line)

	for j := 0; j < t; j++ {
		line, _ := reader.ReadString('\n')
		n, _ := strconv.Atoi(line)
		str, _ := reader.ReadString('\n')
		lst := integer_list(str, " ")
		fmt.Println(lst, n, t)
		continue
		if n%2 == 1 {
			fmt.Println(-1)
		} else {
			ans := []int{}
			for i := 0; i < n-1; i += 2 {
				if lst[i] == lst[i+1] {
					ans = append(ans, i+1, i+2)
				} else {
					ans = append(ans, i+1, i+1, i+2, i+2)
				}
			}
			fmt.Println(len(ans) / 2)
			for i := 0; i < len(ans)-1; i += 2 {
				fmt.Println(ans[i], ans[i+1])
			}
		}

		// ws.Flush()

	}

}

package main

import (
	"bufio"
	"fmt"
	"io/ioutil"
	"os"
)

var bytes []byte
var l, max int

func fastScan() int {
	b := bytes[l]

	// Check if the bytes is not a number
	for b < 48 || b > 57 {
		l++
		b = bytes[l]
	}

	result := 0
	for 47 < b && b < 58 {
		result = (result << 3) + (result << 1) + int(b-48)

		l++
		if l > max {
			return result
		}
		b = bytes[l]
	}
	return result
}

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	// fmt.Println("hello")
	bytes, _ = ioutil.ReadAll(bufio.NewReader(os.Stdin))
	max = len(bytes) - 1
	// defer writer.Flush()
	// ws := bufio.NewWriter(os.Stdout)
	// scanf("%d %d\n", &a, &b)
	// printf("%d\n", a+b)
	var t int
	scanf("%d\n", &t)

	for j := 0; j < t; j++ {
		lst := []int{}
		var n int
		scanf("%d\n", &n)
		var x int
		for ele := 0; ele < n; ele++ {
			scanf("%d", &x)
			lst = append(lst, x)
		}
		lst = append(lst, x)
		if n%2 == 1 {
			fmt.Println(-1)
		} else {
			ans := []int{}
			for i := 0; i < n-1; i += 2 {
				if lst[i] == lst[i+1] {
					ans = append(ans, i+1, i+2)
				} else {
					ans = append(ans, i+1, i+1, i+2, i+2)
				}
			}
			fmt.Println(len(ans) / 2)
			for i := 0; i < len(ans)-1; i += 2 {
				fmt.Println(ans[i], ans[i+1])
			}
		}

		// ws.Flush()

	}

}

package main

import (
	"bufio"
	"fmt"
	"io/ioutil"
	"os"
)

var bytes []byte
var l, max int

func fastScan() int {
	b := bytes[l]

	// Check if the bytes is not a number
	for b < 48 || b > 57 {
		l++
		b = bytes[l]
	}

	result := 0
	for 47 < b && b < 58 {
		result = (result << 3) + (result << 1) + int(b-48)

		l++
		if l > max {
			return result
		}
		b = bytes[l]
	}
	return result
}

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	// fmt.Println("hello")
	bytes, _ = ioutil.ReadAll(bufio.NewReader(os.Stdin))
	max = len(bytes) - 1
	// defer writer.Flush()
	// ws := bufio.NewWriter(os.Stdout)
	// scanf("%d %d\n", &a, &b)
	// printf("%d\n", a+b)
	var t int
	scanf("%d\n", &t)

	for j := 0; j < t; j++ {
		lst := []int{}
		var n int
		scanf("%d\n", &n)
		var x int
		for ele := 0; ele < n-1; ele++ {
			scanf("%d ", &x)
			lst = append(lst, x)
		}
		scanf("%d\n", &x)
		lst = append(lst, x)
		if n%2 == 1 {
			fmt.Println(-1)
		} else {
			ans := []int{}
			for i := 0; i < n-1; i += 2 {
				if lst[i] == lst[i+1] {
					ans = append(ans, i+1, i+2)
				} else {
					ans = append(ans, i+1, i+1, i+2, i+2)
				}
			}
			fmt.Println(len(ans) / 2)
			for i := 0; i < len(ans)-1; i += 2 {
				fmt.Println(ans[i], ans[i+1])
			}
		}

		// ws.Flush()

	}

}

package main

import (
	"bufio"
	"fmt"
	"io/ioutil"
	"os"
)

var bytes []byte
var l, max int

func fastScan() int {
	b := bytes[l]

	// Check if the bytes is not a number
	for b < 48 || b > 57 {
		l++
		b = bytes[l]
	}

	result := 0
	for 47 < b && b < 58 {
		result = (result << 3) + (result << 1) + int(b-48)

		l++
		if l > max {
			return result
		}
		b = bytes[l]
	}
	return result
}

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	// fmt.Println("hello")
	bytes, _ = ioutil.ReadAll(bufio.NewReader(os.Stdin))
	max = len(bytes) - 1
	defer writer.Flush()
	// ws := bufio.NewWriter(os.Stdout)
	// scanf("%d %d\n", &a, &b)
	// printf("%d\n", a+b)
	var t int
	scanf("%d\n", &t)

	for j := 0; j < t; j++ {
		lst := []int{}
		var n int
		scanf("%d\n", &n)
		var x int
		for ele := 0; ele < n-1; ele++ {
			scanf("%d ", &x)
			lst = append(lst, x)
		}
		scanf("%d\n", &x)
		lst = append(lst, x)
		if n%2 == 1 {
			fmt.Println(-1)
		} else {
			ans := []int{}
			for i := 0; i < n-1; i += 2 {
				if lst[i] == lst[i+1] {
					ans = append(ans, i+1, i+2)
				} else {
					ans = append(ans, i+1, i+1, i+2, i+2)
				}
			}
			fmt.Println(len(ans) / 2)
			for i := 0; i < len(ans)-1; i += 2 {
				fmt.Println(ans[i], ans[i+1])
			}
		}

		// ws.Flush()

	}

}

package main

import (
	"bufio"
	"fmt"
	"io/ioutil"
	"os"
)

var bytes []byte
var l, max int

func fastScan() int {
	b := bytes[l]

	// Check if the bytes is not a number
	for b < 48 || b > 57 {
		l++
		b = bytes[l]
	}

	result := 0
	for 47 < b && b < 58 {
		result = (result << 3) + (result << 1) + int(b-48)

		l++
		if l > max {
			return result
		}
		b = bytes[l]
	}
	return result
}

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	// fmt.Println("hello")
	bytes, _ = ioutil.ReadAll(bufio.NewReader(os.Stdin))
	max = len(bytes) - 1
	defer writer.Flush()
	// ws := bufio.NewWriter(os.Stdout)
	// scanf("%d %d\n", &a, &b)
	// printf("%d\n", a+b)
	var t int
	scanf("%d \n", &t)

	for j := 0; j < t; j++ {
		lst := []int{}
		var n int
		scanf("%d \n", &n)
		var x int
		for ele := 0; ele < n; ele++ {
			scanf("%d \n", &x)
			lst = append(lst, x)
		}

		if n%2 == 1 {
			fmt.Println(-1)
		} else {
			ans := []int{}
			for i := 0; i < n-1; i += 2 {
				if lst[i] == lst[i+1] {
					ans = append(ans, i+1, i+2)
				} else {
					ans = append(ans, i+1, i+1, i+2, i+2)
				}
			}
			fmt.Println(len(ans) / 2)
			for i := 0; i < len(ans)-1; i += 2 {
				fmt.Println(ans[i], ans[i+1])
			}
		}

		// ws.Flush()

	}

}

package main

import (
	"bufio"
	"fmt"
	"io/ioutil"
	"os"
)

var bytes []byte
var l, max int

func fastScan() int {
	b := bytes[l]

	// Check if the bytes is not a number
	for b < 48 || b > 57 {
		l++
		b = bytes[l]
	}

	result := 0
	for 47 < b && b < 58 {
		result = (result << 3) + (result << 1) + int(b-48)

		l++
		if l > max {
			return result
		}
		b = bytes[l]
	}
	return result
}

func main() {
	// fmt.Println("hello")
	bytes, _ = ioutil.ReadAll(bufio.NewReader(os.Stdin))
	max = len(bytes) - 1

	// ws := bufio.NewWriter(os.Stdout)
	var t int
	t = fastScan()

	for j := 0; j < t; j++ {
		lst := []int{}
		n := fastScan()
		var x int
		for ele := 0; ele < n; ele++ {
			x = fastScan()
			lst = append(lst, x)
		}

		if n%2 == 1 {
			fmt.Println(-1)
		} else {
			ans := []int{}
			for i := 0; i < n-1; i += 2 {
				if lst[i] == lst[i+1] {
					ans = append(ans, i+1, i+2)
				} else {
					ans = append(ans, i+1, i+1, i+2, i+2)
				}
			}
			fmt.Println(len(ans) / 2)
			for i := 0; i < len(ans)-1; i += 2 {
				fmt.Println(ans[i], ans[i+1])
			}
		}

		// ws.Flush()

	}

}

package main

import (
	"bufio"
	"fmt"
	"io/ioutil"
	"os"
)

var bytes []byte
var l, max int

func fastScan() int {
	b := bytes[l]

	// Check if the bytes is not a number
	for b < 48 || b > 57 {
		l++
		b = bytes[l]
	}

	result := 0
	for 47 < b && b < 58 {
		result = (result << 3) + (result << 1) + int(b-48)

		l++
		if l > max {
			return result
		}
		b = bytes[l]
	}
	return result
}

func main() {
	// fmt.Println("hello")
	bytes, _ = ioutil.ReadAll(bufio.NewReader(os.Stdin))
	max = len(bytes) - 1

	// ws := bufio.NewWriter(os.Stdout)
	t := fastScan()

	for j := 0; j < t; j++ {
		lst := []int{}
		n := fastScan()
		var x int
		for ele := 0; ele < n; ele++ {
			x = fastScan()
			lst = append(lst, x)
		}

		if n%2 == 1 {
			fmt.Println(-1)
		} else {
			ans := []int{}
			for i := 0; i < n-1; i += 2 {
				if lst[i] == lst[i+1] {
					ans = append(ans, i+1, i+2)
				} else {
					ans = append(ans, i+1, i+1, i+2, i+2)
				}
			}
			fmt.Println(len(ans) / 2)
			for i := 0; i < len(ans)-1; i += 2 {
				fmt.Println(ans[i], ans[i+1])
			}
		}

		// ws.Flush()

	}

}

package main

import (
	"bufio"
	"fmt"
	"io/ioutil"
	"os"
)

var bytes []byte
var l, max int

func fastScan() int {
	b := bytes[l]

	// Check if the bytes is not a number
	for b < 48 || b > 57 {
		l++
		b = bytes[l]
	}

	result := 0
	for 47 < b && b < 58 {
		result = (result << 3) + (result << 1) + int(b-48)

		l++
		if l > max {
			return result
		}
		b = bytes[l]
	}
	return result
}

func main() {
	// fmt.Println("hello")
	bytes, _ = ioutil.ReadAll(bufio.NewReader(os.Stdin))
	max = len(bytes) - 1

	// ws := bufio.NewWriter(os.Stdout)
	t := fastScan()

	for j := 0; j < t; j++ {
		lst := []int{}
		n := fastScan()
		var x int
		for ele := 0; ele < n; ele++ {
			x = fastScan()
			lst = append(lst, x)
		}

		if n%2 == 1 {
			fmt.Println(-1)
		} else {
			ans := []int{}
			for i := 0; i < n-1; i += 2 {
				if lst[i] == lst[i+1] {
					ans = append(ans, i+1, i+2)
				} else {
					ans = append(ans, i+1, i+1, i+2, i+2)
				}
			}
			fmt.Println(len(ans) / 2)
			for i := 0; i < int(len(ans)/2-1); i += 2 {
				fmt.Println(ans[i], ans[i+1])
			}
		}

		// ws.Flush()

	}

}

package main

import (
	"bufio"
	"fmt"
	"io/ioutil"
	"os"
)

var bytes []byte
var l, max int

func fastScan() int {
	b := bytes[l]

	// Check if the bytes is not a number
	for b < 48 || b > 57 {
		l++
		b = bytes[l]
	}

	result := 0
	for 47 < b && b < 58 {
		result = (result << 3) + (result << 1) + int(b-48)

		l++
		if l > max {
			return result
		}
		b = bytes[l]
	}
	return result
}

func main() {
	// fmt.Println("hello")
	bytes, _ = ioutil.ReadAll(bufio.NewReader(os.Stdin))
	max = len(bytes) - 1

	// ws := bufio.NewWriter(os.Stdout)
	t := fastScan()

	for j := 0; j < t; j++ {
		lst := []int{}
		n := fastScan()
		var x int
		for ele := 0; ele < n; ele++ {
			x = fastScan()
			lst = append(lst, x)
		}

		if n%2 == 1 {
			fmt.Println(-1)
		} else {
			ans := []int{}
			for i := 0; i < n-1; i += 2 {
				if lst[i] == lst[i+1] {
					ans = append(ans, i+1, i+2)
				} else {
					ans = append(ans, i+1, i+1, i+2, i+2)
				}
			}
			fmt.Println(len(ans) / 2)
			for i := 0; i < int(len(ans)/2); i += 2 {
				fmt.Println(ans[i], ans[i+1])
			}
		}

		// ws.Flush()

	}

}

package main

import (
	."fmt"
	."os"
)

func solve(){
	var n int
	Fscan(Stdin, &n)
	sz := make([]int, n)
	for i := 0; i < n; i++ {
		Fscan(Stdin, &sz[i])
	}
	tot := 0
	last := 0
	break_arr := make([]int, n)
	for i := 0; i < n; i++{
		if last == 0{
			last = sz[i]
			tot = sz[i]
		}else{
			if sz[i] == last{
				tot = 0
			}else{
				if tot == 0{
					break_arr[i - 1] = 1
					tot = sz[i]
					last = sz[i]
				}else{
					break_arr[i - 1] = 1
					break_arr[i] = 1
					tot = 0
					last = 0
				}
			}
		}
	}
	// for i := 0; i < n; i ++{
	// 	Fprintln(Stdout, break_arr[i])
	// }
	if tot == 0{
		break_arr[n - 1] = 1
		out_n := 0
		for i := 0; i < n; i++{
			if break_arr[i] == 1{
				out_n ++
			}
		}
		Fprintln(Stdout, out_n)
		l := 1
		for i := 0; i < n; i++{
			if break_arr[i] == 1{
				Fprintln(Stdout, l, i + 1)
				l = i + 2
			}
		}
	}else{
		Fprintln(Stdout, -1)
	}
}

func main(){
	var t int
	Fscan(Stdin, &t)
	for ; t > 0; t--{
		solve()
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

type seg struct {
	l int
	r int
}

func main() {
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var T int
	for fmt.Fscan(r, &T); T > 0; T-- {

		var n, rsum int
		fmt.Fscan(r, &n)
		a := make([]int, n)

		for i := range a {
			fmt.Fscan(r, &a[i])
			rsum += (2 + a[i]) % 2
		}

		if rsum % 2 == 1 {
			fmt.Fprintln(w, -1)
		} else {
			segc := 0
			segs := make([]seg, n)
			for j := 0; j < n; j += 2 {
				if a[j] == a[j+1] {
					segs[segc] = seg{j, j+1}
					segc++
				} else {
					segs[segc] = seg{j, j}
					segs[segc+1] = seg{j+1, j+1}
					segc += 2
				}
			}

			fmt.Fprintln(w, segc)
			for j := 0; j < segc; j++ {
				fmt.Fprintln(w, segs[j].l, segs[j].r)
			}
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	r, w := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var epochs int
	fmt.Fscan(r, &epochs)
	for ; epochs > 0; epochs-- {
		var n, n1, n2 int
		fmt.Fscan(r, &n)

		if n&1 == 1 {
			for i := 0; i <= n; i++ {
				fmt.Fscan(r, &n1)
			}
			fmt.Fprintln(w, "-1")
		} else {
			list := []int{}
			flag := 0
			for i := 1; i <= n; i += 2 {
				fmt.Fscan(r, &n1, &n2)
				if n1 == n2 {
					if flag == 1 {
						list[len(list)-1] = i + 1
					} else {
						list = append(list, i, i+1)
					}
					flag = 1
				} else {
					list = append(list, i, i, i+1, i+1)
					flag = 0
				}
			}

			fmt.Fprintln(w, len(list)>>1)
			for i := 0; i < len(list); i += 2 {
				fmt.Fprintln(w, list[i], list[i+1])
			}
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	r, w := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var epochs int
	fmt.Fscan(r, &epochs)
	for ; epochs > 0; epochs-- {
		var n int
		fmt.Fscan(r, &n)

		if n&1 == 1 {
			fmt.Fprintln(w, "-1")
		} else {
			list := []int{}
			flag := 0
			var n1, n2 int
			for i := 1; i <= n; i += 2 {
				fmt.Fscan(r, &n1)
				fmt.Fscan(r, &n2)
				if n1 == n2 {
					if flag == 1 {
						list[len(list)-1] = i + 1
					} else {
						list = append(list, i, i+1)
					}
					flag = 1
				} else {
					list = append(list, i, i, i+1, i+1)
					flag = 0
				}
			}

			fmt.Fprintln(w, len(list)>>1)
			for i := 0; i < len(list); i += 2 {
				fmt.Fprintln(w, list[i], list[i+1])
			}
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	var epochs int
	fmt.Scanf("%d\n", &epochs)
	res := ""
	for ; epochs > 0; epochs-- {
		var n int
		fmt.Scanf("%d\n", &n)
		scanner := bufio.NewScanner(os.Stdin)
		scanner.Split(bufio.ScanWords)
		list := make([]int, 0, n)
		for i := n; i > 0 && scanner.Scan(); i-- {
			tmp, _ := strconv.Atoi(scanner.Text())
			list = append(list, tmp)
		}

		if n&1 == 1 {
			res += "-1\n"
		} else {
			k := 0
			line := ""
			for i := 0; i < len(list); i += 2 {
				if list[i] == list[i+1] {
					// + -
					line += fmt.Sprintf("%d %d\n", i+1, i+2)
					k++
				} else {
					// + +
					line += fmt.Sprintf("%d %d\n", i+1, i+1)
					line += fmt.Sprintf("%d %d\n", i+2, i+2)
					k++
					k++
				}
			}
			res += fmt.Sprintf("%d\n%s", k, line)
		}
	}
	fmt.Print(res)
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	var epochs int
	fmt.Scanf("%d\n", &epochs)
	for ; epochs > 0; epochs-- {
		var n int
		fmt.Scanf("%d\n", &n)
		scanner := bufio.NewScanner(os.Stdin)
		scanner.Split(bufio.ScanWords)
		list := make([]int, 0, n)
		for i := n; i > 0 && scanner.Scan(); i-- {
			tmp, _ := strconv.Atoi(scanner.Text())
			list = append(list, tmp)
		}

		if n&1 == 1 {
			fmt.Println("-1")
		} else {
			k := 0
			res := ""
			for i := 0; i < len(list); i += 2 {
				if list[i] == list[i+1] {
					// + -
					res += fmt.Sprintf("%d %d\n", i+1, i+2)
					k++
				} else {
					// + +
					res += fmt.Sprintf("%d %d\n", i+1, i+1)
					res += fmt.Sprintf("%d %d\n", i+2, i+2)
					k++
					k++
				}
			}
			fmt.Printf("%d\n%s", k, res)
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	var epochs int
	fmt.Scanln(&epochs)
	for ; epochs > 0; epochs-- {
		var n int
		fmt.Scanf("%d\n", &n)
		scanner := bufio.NewScanner(os.Stdin)
		scanner.Split(bufio.ScanWords)
		list := make([]int, 0, n)
		for i := n; i > 0 && scanner.Scan(); i-- {
			tmp, _ := strconv.Atoi(scanner.Text())
			list = append(list, tmp)
		}

		if n&1 == 1 {
			fmt.Println("-1")
		} else {
			m := 0
			res := ""
			for i := 0; i < len(list); i += 2 {
				if list[i] == list[i+1] {
					// + -
					res += fmt.Sprintf("%d %d\n", i+1, i+2)
					m++
				} else {
					// + +
					res += fmt.Sprintf("%d %d\n", i+1, i+1)
					res += fmt.Sprintf("%d %d\n", i+2, i+2)
					m++
					m++
				}
			}
			fmt.Printf("%d\n%s", m, res)
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	var epochs int
	fmt.Scanln(&epochs)
	for ; epochs > 0; epochs-- {
		var n int
		fmt.Scanln(&n)
		scanner := bufio.NewScanner(os.Stdin)
		scanner.Split(bufio.ScanWords)
		list := make([]int, 0, n)
		for i := n; i > 0 && scanner.Scan(); i-- {
			tmp, _ := strconv.Atoi(scanner.Text())
			list = append(list, tmp)
		}

		if n&1 == 1 {
			fmt.Println("-1")
		} else {
			m := 0
			res := ""
			for i := 0; i < len(list); i += 2 {
				if list[i] == list[i+1] {
					// + -
					res += fmt.Sprintf("%d %d\n", i+1, i+2)
					m++
				} else {
					// + +
					res += fmt.Sprintf("%d %d\n", i+1, i+1)
					res += fmt.Sprintf("%d %d\n", i+2, i+2)
					m++
					m++
				}
			}
			fmt.Printf("%d\n%s", m, res)
		}
	}
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	n := 0
	fmt.Fscanf(in, "%d\n", &n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(in, "%d", &a[i])
	}
	fmt.Fscanf(in, "\n")

	sum := int64(0)
	sort.Ints(a)
	b := make([]int, 0)
	for i := 0; i < n; i++ {
		b = append(b, a[n-1-i])
		sum += int64(b[i])
	}
	m := 0
	fmt.Fscanf(in, "%d\n", &m)
	//fmt.Println(m)
	q := 0
	for i := 0; i < m; i++ {
		fmt.Fscanf(in, "%d", &q)
		fmt.Fprintf(out, "%d\n", sum-int64(b[q-1]))
	}
	return
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

type SA []int

func (s SA) Len() int {
	return len(s)
}

func (s SA) Swap(a, b int) {
	tmp := s[a]
	s[a] = s[b]
	s[b] = tmp
}
func (s SA) Less(i, j int) bool {
	if s[i] > s[j] {
		return true
	}
	return false
}
func main() {
	buf := bufio.NewReader(os.Stdin)

	var n int
	var sum int64 = 0
	fmt.Fscanf(buf, "%d\n", &n)

	mat := make(SA, n)

	for i := 0; i < n; i++ {
		fmt.Fscanf(buf, "%d", &mat[i])
		sum += int64(mat[i])
	}
	fmt.Fscanf(buf, "\n")
	sort.Sort(mat)
	var m int
	fmt.Fscanf(buf, "%d\n", &m)
	mp := make([]int, n)
	for i:= 0;i < m;i++{
		fmt.Fscanf(buf, "%d", &mp[i])
	}
	fmt.Fscanf(buf, "\n")
	for i:= 0;i < m;i++{
		fmt.Printf("%d\n", sum-int64(mat[mp[i]-1]))
	}
}

package main

import (
	"bufio"
	"bytes"
	"fmt"
	"io"
	"os"
	"sort"
	"strconv"
)

// -----------------------------------------------------------------------------

// IO helper functions

// Returns next token from input.  It must be initialized by SetInput()
// before the first call.
var nextToken func() ([]byte, error)
var nextLine func() ([]byte, error)

// Holds a buffer for output.  It must be initialized by SetOutput().
// All IO fucntions (read*() and [e]print*()) should write to OutputWriter
// instead of this.
var OutputBuffer *bufio.Writer

// Holds an io.Writer.  It must be initialized by SetOutput()
var OutputWriter io.Writer

// Set IO functions for interactive input/output.
func SetInteractive(w io.Writer, r io.Reader) {
	SetUnbefferedInput(r)
	OutputBuffer = nil
	OutputWriter = w
}

// Setup OutputBuffer and OutputWriter.
func SetOutput(w io.Writer) {
	OutputBuffer = bufio.NewWriter(w)
	OutputWriter = OutputBuffer
}

// Flushes OutputBuffer
func Flush() {
	if OutputBuffer != nil {
		OutputBuffer.Flush()
	}
}

// Returns true if c is a white space
func IsSpace(c byte) bool {
	switch c {
	case '\t', '\n', '\v', '\f', '\r', ' ':
		return true
	}
	return false
}

func IsNewLine(c byte) bool {
	switch c {
	case '\n', '\r':
		return true
	}
	return false
}

// Setup nextToken with input buffer.
func SetInput(r io.Reader) {
	buf := new(bytes.Buffer)
	var b []byte

	var i int
	rest := func() ([]byte, error) {
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		return b[j:i], nil
	}
	initial := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextToken = rest
		return rest()
	}
	nextToken = initial

	restLn := func() ([]byte, error) {
		for i < len(b) && IsNewLine(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsNewLine(b[i]) {
			i++
		}
		return b[j:i], nil
	}

	initialLn := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextLine = restLn
		return restLn()
	}
	nextLine = initialLn
}

// Setup nextToken without input buffer.
func SetUnbefferedInput(r io.Reader) {
	buf := bufio.NewReader(r)
	var b []byte

	var i int
	nextToken = func() ([]byte, error) {
		var err error
		if i == len(b) {
			b, err = buf.ReadBytes('\n')
			if err != nil {
				return nil, err
			}
			i = 0
			j := len(b) - 1
			for 0 <= j && IsSpace(b[j]) {
				j--
			}
			b = b[0 : j+1]
		}
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		if i == j {
			return nil, io.ErrUnexpectedEOF
		}
		return b[j:i], nil
	}
}

// -----------------------------------------------------------------------------

// IO functions

// Reads next token and return it as []byte
func readb() []byte {
	b, err := nextToken()
	if err != nil {
		panic(err)
	}
	return b
}

// Reads next token and return it as string
func reads() string {
	return string(readb())
}

// Read next line as []byte
func readbln() []byte {
	b, err := nextLine()
	if err != nil {
		panic(err)
	}
	return b
}

// Read next line as string
func readsln() string {
	return string(readbln())
}

// Reads next token and return it as int64
func readll() int64 {
	i, err := strconv.ParseInt(reads(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// Reads next token and return it as int
func readi() int {
	return int(readll())
}

// Reads next token and return it as float64
func readf() float64 {
	f, err := strconv.ParseFloat(reads(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// Write args to OutputWriter with the format f
func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(OutputWriter, f, args...)
}

// Write args to OutputWriter without format
func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(OutputWriter, args...)
}

// Write args to stderr with the format f
func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// Write args to stderr without format
func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// -----------------------------------------------------------------------------

// Simple math functions

const (
	// big prime
	INF  = 1000000007
	INF2 = 1000000009
	INF3 = 998244353
)

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func minll(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func maxll(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absll(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// egcd(a, b) returns d, x, y:
//   d is gcd(a,b)
//   x, y are  integers that satisfy ax + by = d
func egcd(a, b int) (int, int, int) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcd(b, a%b)
	return d, y, x - a/b*y
}

func egcdll(a, b int64) (int64, int64, int64) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcdll(b, a%b)
	return d, y, x - a/b*y
}

func gcd(a, b int) int {
	d, _, _ := egcd(a, b)
	return d
}

func gcdll(a, b int64) int64 {
	d, _, _ := egcdll(a, b)
	return d
}

// set up IO functions
func init() {
	// for non-interactive
	SetInput(os.Stdin)
	SetOutput(os.Stdout)

	// Enable below when interactive.  Its ok to leave above intact.
	// SetInteractive(os.Stdout, os.Stdin)
}

func main() {
	defer Flush()

	n := readi()
	a := make([]int64, n)
	for i := range a {
		a[i] = readll()
	}
	m := readi()
	q := make([]int, m)
	for i := range q {
		q[i] = readi()
	}

	sort.Slice(a, func(i, j int) bool { return a[i] > a[j] })
	var s int64
	for i := range a {
		s += a[i]
	}

	for _, v := range q {
		v--
		println(s - a[v])
	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func max(x, y int) int {
	if x < y {
		return y
	}
	return x
}

func main() {
	defer writer.Flush()
	var n, m, t1 int

	var tot int64

	arr := []int{}

	scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		scanf("%d", &t1)
		tot += int64(t1)
		arr = append(arr, t1)
	}

	sort.Ints(arr)

	scanf("\n%d\n", &m)

	for i := 0; i < m; i++ {
		scanf("%d", &t1)
		//t1--
		printf("%d\n", tot-int64(arr[n-t1]))
	}

}