

// function getMinKey(obj) {
// 	var min = 0
// 	var min_key = ""
// 	for (var key in obj) {
// 		if (obj[key] > max) {
// 			max = obj[max]
// 			max_key = key
// 		}
// 	}
// 	return key
// }

function main(arg) {
	//var n = Number(arg.split("\n")[0])
	var v = arg.split("\n")[1].split(" ").map((e) => Number(e))
	var even = []
	var odd = []

	for (var i = 0; i < v.length; i++) {
		if ( i%2 === 0) {
			even.push(v[i])
		} else {
			odd.push(v[i])
		}
	}

	eu = even.filter((x, i, self) => self.indexOf(x) === i)
	ou = odd.filter((x, i, self) => self.indexOf(x) === i)

	if (eu.length === 1 && ou.length === 1) {
		if (eu[0] === ou[0]) {
			console.log(even.length)
		} else{
			console.log(0)
		}
		return
	}

	if (eu.length !== 1) {
		even.sort()
		var arr = []
		var count = 0
		arr[count] = 1
		for (var i = 1; i < even.length; i++ ) {
			if (even[i] === even[i-1]) {
				arr[count]++
			} else {
				count++
				arr[count] = 0
			}
		}
			
		
		arr.pop()
		var sum = 0;
		arr.forEach(function(elm) {
			sum += elm;
		});
		console.log(sum)
		
	}

	if (ou.length !== 1) {
		even = odd
		even.sort()
		var arr = []
		var count = 0
		arr[count] = 1
		for (var i = 1; i < even.length; i++ ) {
			if (even[i] === even[i-1]) {
				arr[count]++
			} else {
				count++
				arr[count] = 0
			}
		}
			
		
		arr.pop()
		var sum = 0;
		arr.forEach(function(elm) {
			sum += elm;
		});
		console.log(sum)
	}

	// var arr = eu.concat(ou).filter((x, i, self) => self.indexOf(x) === i)

	// arr.forEach(e => {
	// 	var i = v.filter( function( value ) {
	// 		return value === e
	// 	}).length

	// 	console.log(i)
	// })


}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));