"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
function iInpArr() {
  return readline()
    .trim()
    .split(" ")
    .map((cur) => parseInt(cur));
}
function BInpArr() {
  return readline()
    .trim()
    .split(" ")
    .map((cur) => BigInt(cur));
}
function string() {
  return readline().trim();
}
function stringArr() {
  return readline().trim().split("");
}
function getValue() {
  return parseInt(readline());
}
let mod = BigInt(1e9 + 7);
const solve = () => {
  let t = getValue();
  while (t--) {
    let n = getValue();
    let arr = iInpArr();
    arr.sort((a, b) => a - b);
    let narr = [],
      sum = 0;
    for (let i = 0; i < n; i++) {
      narr.push(arr[i]);
      sum += arr[i];
    }
    if (sum === arr[n] || sum === arr[n + 1]) console.log(narr.join(" "));
    else {
      let flag = true,
        s1 = sum;
      for (let i = n - 1; i >= 0; i--) {
        s1 = sum + arr[n];
        s1 -= narr[i];
        if (s1 === arr[n + 1]) {
          narr[i] = arr[n];
          console.log(narr.join(" "));
          flag = false;
          break;
        }
      }
      if (flag) console.log(-1);
    }
  }
};
solve();

var num = readline().split(" ").map(x => parseInt(x)); // num will be an array [1,2,3]

var n = num[0];
for (var index = 0; index < n; index++) {
    var m = readline().split(" ").map((x) => parseInt(x));
    var numbers = readline().split(" ").map((x) => parseInt(x));

    // for (var j = 1; j < numbers.length; j++) {
    //     if (max < numbers[j]) {
    //         max = numbers[j];
    //     }
    // }
    numbers.sort((a, b) => a - b);
    var max = numbers[numbers.length - 1];
        // write(max + ' max \n');
    for (var j = 0; j < numbers.length - 1; j++) {
        max -= numbers[j];
        // write(max + ' max \n');
    }

    var result = [];

    var finded = max * -1;
    var findedIndex = numbers.indexOf(finded);
    if (findedIndex != -1 && findedIndex != numbers.length - 1) {
        // write(findedIndex + ' findedIndex \n');
        numbers.splice(findedIndex, 1);
        numbers.splice(-1, 1);
        result = numbers;
    } else {
        max = numbers[numbers.length - 2];
        for (var j = 0; j < numbers.length - 2; j++) {
            // write(max + ' max \n');
            max -= numbers[j];
        }
        if (max == 0) {
            numbers.splice(-2, 2);
            result = numbers;
        } else {
            result = [-1];
        }

    }

    write(result.join(' ') + '\n');

}

var t = parseInt(readline());

for (var test = 0; test < t; test++) {
    var n = parseInt(readline());
    var arr = readline().split(' ');
    var ans = [];

    var iMax1 = parseInt(arr[0]) >= parseInt(arr[1]) ? 0 : 1;
    var iMax2 = parseInt(arr[0]) >= parseInt(arr[1]) ? 1 : 0;

    for (var i = 2; i < n + 2; i++) {
        if (parseInt(arr[i]) > parseInt(arr[iMax1])) {
            iMax2 = iMax1;
            iMax1 = i;
        } else if (parseInt(arr[i]) > parseInt(arr[iMax2])) {
            iMax2 = i;
        }
    }

    var arrSum = arr.reduce((sum, item) => sum += parseInt(item), 0);

    var testMax = iMax => {
        for (var i = 0; i < n + 2; i++) {
            if (i !== iMax && arrSum - arr[i] - arr[iMax] === parseInt(arr[iMax])) {
                for (var j = 0; j < n + 2; j ++) {
                    if (j !== i && j !== iMax) {
                        ans.push(arr[j]);
                    }
                }
                print(ans.join(' '));
                return true;
            }
        }
    }

    if (!testMax(iMax1)) {
        if (!testMax(iMax2)) {
            print('-1');
        }
    }
}

function solution(n,array) {
  var pointer = 0;
  var result = null;
  var noResult = false;
  var sortedArray = array.sort((a, b) => a - b);

  const firstTotal = [...sortedArray]
    .slice(0, n)
    .reduce((total, currentValue) => total + currentValue);

  if (firstTotal === sortedArray[n] || firstTotal === sortedArray[n + 1]) {
    return [...sortedArray].slice(0, n).join(' ');
  } else if (firstTotal > sortedArray[n] && firstTotal > sortedArray[n + 1]) {
    return -1;
  } else {
    const secondTotal = firstTotal + sortedArray[n];
    var i=0;

    while(i <= n-1 && ((secondTotal - sortedArray[i]) !== sortedArray[n + 1])){
        i++;
    }

    if(i===n){
        return -1;
    }
    return [...sortedArray].slice(0, n+1).filter((item,index)=> index !== i).join(' ');
  }
}

var iteration = parseInt(readline());
for(var i=0; i<iteration; i++){
    print(
        solution(
            parseInt(readline()),
            readline().split(' ').map(x => parseInt(x))
            )
        );
}

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

function main () {
	let t = rn();
	while (t--) {
		let n = rn();
		let b = rna();

		let have = new Map();
		let sm = 0;
		for (x of b) {
			sm += x;
			have.set(x, 1 + (have.has(x) ? have.get(x) : 0));
		}

		let ans;
		for (let i = 0; !ans && i < n + 2; i++) {
			const x = sm - 2 * b[i];
			if (have.has(x)) {
				if (x == b[i] && have.get(x) < 2)
					continue;
				ans = b.slice();
				ans.splice(ans.indexOf(b[i]), 1);
				ans.splice(ans.indexOf(x), 1);
			}
		}

		console.log(ans ? ans.join(' ') : -1);
	}
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
  inputString += inputStdin;
});

process.stdin.on('end', _ => {
  inputString = inputString.trim().split('\n').map(string => {
    return string.trim();
  });

  main();
});

function readline() {
  return inputString[currentLine++];
}

var maxN = 21
var mod = 1000000007

// Make a Snippet for the code above this and then write your logic in main();

function main() {
  const xx = readline();

  Array(Number(xx)).fill(1).map((t, i) => {
    var n = parseInt(readline());
    // var [x, y] = readline().split(' ').map((x, iii) => {
    //   return parseInt(x)
    // });
    var a = readline().split(' ').map((x, iii) => {
      return BigInt(x)
    })
    n = n + 2
    var sum = 0n
    var object = {}
    for (let j = 0; j < n; j++) {
      sum += a[j]
      if (!object[a[j]]) object[a[j]] = 0
      object[a[j]]++
    }
    var ans = []
    var minus1 = false
    var minus2 = false
    for (let j = 0; j < n; j++) {
      var number = sum - a[j]
      if (number / 2n === a[j] && object[number / 2n] === 1) continue
      if (number % 2n === 0n && object[number / 2n]) {
        for (let i = 0; i < n; i++) {
          if (a[i] === a[j] && !minus1) {
            minus1 = true
            continue
          }
          if (a[i] === number / 2n && !minus2) {
            minus2 = true
            continue
          }
          ans.push(a[i])
        }
        console.log(ans.join(' '))
        return
      }
    }
    console.log(-1)

  })
}

'use strict';
const readline = require('readline');
const util = require('util');
const rl = readline.createInterface({
    input: process.stdin,
});
let pos = 0;
const words = [];
rl.on('line', (line) => {
    words.push.apply(words, line.split(' ').filter(s => s != ''));
});
rl.on('close', main);
function check(b) {
    if (!b) {
        process.stderr.write(`${new Error().stack}\n`);
        process.exit(-1);
    }
}
function printf(...args) {
    process.stdout.write(util.format(...args));
}
function nextInt() {
    return Math.trunc(Number(words[pos++]));
}
function nextStr() {
    return words[pos++];
}
function af(l) {
    return Array.from({ length: l });
}
const INIT = -1;
let n;
let b;
function solve() {
    b.sort((x, y) => x - y);
    let mx = b[b.length - 1];
    let sum = 0;
    for (let i = 0; i < b.length; i++) {
        sum += b[i];
    }
    for (let i = 0; i + 1 < b.length; i++) {
        const rem = sum - b[i];
        if (rem % 2 != 0) {
            continue;
        }
        if (mx * 2 == rem) {
            const t = b[b.length - 2];
            b[b.length - 2] = b[i];
            b[i] = t;
            return true;
        }
    }
    let x = b[b.length - 1];
    mx = b[b.length - 2];
    if (mx * 2 + x == sum) {
        return true;
    }
    return false;
}
function main() {
    let tc = nextInt();
    while (tc-- > 0) {
        n = nextInt();
        b = af(n + 2);
        for (let i = 0; i < n + 2; i++) {
            b[i] = nextInt();
        }
        if (solve()) {
            for (let i = 0; i < n; i++) {
                printf("%d ", b[i]);
            }
            printf("\n");
        }
        else {
            printf("%d\n", INIT);
        }
    }
}

var num = readline().split(" ").map(x => parseInt(x)); // num will be an array [1,2,3]

var n = num[0];
for (var index = 0; index < n; index++) {
    var m = readline().split(" ").map((x) => parseInt(x));
    var numbers = readline().split(" ").map((x) => parseInt(x));

    // for (var j = 1; j < numbers.length; j++) {
    //     if (max < numbers[j]) {
    //         max = numbers[j];
    //     }
    // }
    numbers.sort((a, b) => a - b);
    var max = numbers[numbers.length - 1];
        // write(max + ' max \n');
    for (var j = 0; j < numbers.length - 1; j++) {
        max -= numbers[j];
        // write(max + ' max \n');
    }

    var result = [];

    var finded = max * -1;
    var findedIndex = numbers.indexOf(finded);
    if (findedIndex != -1 && findedIndex != numbers.length - 1) {
        // write(findedIndex + ' findedIndex \n');
        numbers.splice(findedIndex, 1);
        numbers.splice(-1, 1);
        result = numbers;
    } else {
        max = numbers[numbers.length - 2];
        for (var j = 0; j < numbers.length - 1; j++) {
            // write(max + ' max \n');
            max -= numbers[j];
        }
        if (max == 0) {
            numbers.splice(-2, 2);
            result = numbers;
        } else {
            result = [-1];
        }

    }

    write(result.join(' ') + '\n');

}

var num = readline().split(" ").map(x => parseInt(x)); // num will be an array [1,2,3]

var n = num[0];
for (var index = 0; index < n; index++) {
    var m = readline().split(" ").map((x) => parseInt(x));
    var numbers = readline().split(" ").map((x) => parseInt(x));

    // for (var j = 1; j < numbers.length; j++) {
    //     if (max < numbers[j]) {
    //         max = numbers[j];
    //     }
    // }
    numbers.sort((a, b) => a - b);
    var max = numbers[numbers.length - 1];
        // write(max + ' max \n');
    for (var j = 0; j < numbers.length - 1; j++) {
        max -= numbers[j];
        // write(max + ' max \n');
    }

    var result = [];

    var finded = max * -1;
    var findedIndex = numbers.indexOf(finded);
    if (findedIndex != -1) {
        // write(findedIndex + ' findedIndex \n');
        numbers.splice(findedIndex, 1);
        numbers.splice(-1, 1);
        result = numbers;
    } else {
        max = numbers[numbers.length - 2];
        for (var j = 0; j < numbers.length - 1; j++) {
            max -= numbers[j];
        }
        if (max == 0) {
            numbers.splice(-2, 2);
            result = numbers;
        } else {
            result = [-1];
        }

    }

    write(result.join(' ') + '\n');

}

var t = parseInt(readline());

for (var test = 0; test < t; test++) {
    var n = parseInt(readline());
    var arr = readline().split(' ');

    var iMax1 = parseInt(arr[0]) >= parseInt(arr[1]) ? 0 : 1;
    var iMax2 = parseInt(arr[0]) >= parseInt(arr[1]) ? 1 : 0;

    for (var i = 2; i < n + 2; i++) {
        if (parseInt(arr[i]) > parseInt(arr[iMax1])) {
            iMax2 = iMax1;
            iMax1 = i;
        } else if (parseInt(arr[i]) > parseInt(arr[iMax2])) {
            iMax2 = i;
        }
    }

    var arrSum = arr.reduce((sum, item) => sum += parseInt(item), 0);

    var testMax = iMax => {
        for (var i = 0; i < n + 2; i++) {
            if (i !== iMax && arrSum - arr[i] - arr[iMax] === parseInt(arr[iMax])) {
                arr.splice(i, 1);
                arr.splice(iMax, 1);
                print(arr.join(' '));
                return true;
            }
        }
    }

    if (!testMax(iMax1)) {
        if (!testMax(iMax2)) {
            print('-1');
        }
    }
}

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

function main () {
	let t = rn();
	while (t--) {
		let n = rn();
		let b = rna();

		let have = new Map();
		let sm = 0;
		for (x of b) {
			sm += x;
			have.set(x, 1 + (have.has(x) ? have.get(x) : 0));
		}

		let ans;
		for (let i = 0; !ans && i < n + 2; i++) {
			const x = sm - 2 * b[i];
			if (have.has(x)) {
				if (x == b[i] && have.get(x) != 2)
					continue;
				ans = b.slice();
				ans.splice(ans.indexOf(b[i]), 1);
				ans.splice(ans.indexOf(x), 1);
			}
		}

		console.log(ans ? ans.join(' ') : -1);
	}
}

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

function main () {
	let t = rn();
	while (t--) {
		let n = rn();
		let b = rna();

		let have = new Map();
		let sm = 0;
		for (x of b) {
			sm += x;
			have.set(x, 1 + (have.has(x) ? have.get(x) : 0));
		}

		let ans;
		for (let i = 0; !ans && i < n + 2; i++) {
			const x = sm - 2 * b[i];
			if (have.has(x)) {
				ans = b.slice();
				ans.splice(ans.indexOf(b[i]), 1);
				ans.splice(ans.indexOf(x), 1);
			}
		}

		console.log(ans ? ans.join(' ') : -1);
	}
}

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

function main () {
	let t = rn();
	while (t--) {
		let n = rn();
		let b = rna();

		let sm = 0;
		for (x of b) sm += x;

		let ans;
		for (let i = 0; !ans && i < n + 2; i++) {
			const x = sm - 2 * b[i];
			for (let j = 0; !ans && j < n + 2; j++)
				if (b[j] == x) {
					ans = b.slice();
					ans.splice(ans.indexOf(b[i]), 1);
					ans.splice(ans.indexOf(b[j]), 1);
				}
		}

		console.log(ans ? ans.join(' ') : -1);
	}
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
  inputString += inputStdin;
});

process.stdin.on('end', _ => {
  inputString = inputString.trim().split('\n').map(string => {
    return string.trim();
  });

  main();
});

function readline() {
  return inputString[currentLine++];
}

var maxN = 21
var mod = 1000000007

// Make a Snippet for the code above this and then write your logic in main();

function main() {
  const xx = readline();

  Array(Number(xx)).fill(1).map((t, i) => {
    var n = parseInt(readline());
    // var [x, y] = readline().split(' ').map((x, iii) => {
    //   return parseInt(x)
    // });
    var a = readline().split(' ').map((x, iii) => {
      return parseInt(x)
    })
    n = n + 2
    var sum = 0
    var object = {}
    for (let j = 0; j < n; j++) {
      sum += a[j]
      object[a[j]] = true
    }
    var ans = []
    var minus1 = false
    var minus2 = false
    for (let j = 0; j < n; j++) {
      var number = sum - a[j]
      if (number % 2 === 0 && object[number / 2]) {
        for (let i = 0; i < n; i++) {
          if (a[i] === a[j] && !minus1) {
            minus1 = true
            continue
          }
          if (a[i] === number / 2 && !minus2) {
            minus2 = true
            continue
          }
          ans.push(a[i])
        }
        console.log(ans.join(' '))
        return
      }
    }
    console.log(-1)

  })
}


const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;

rl.on('line', (d) => {
  if (c === 0) {
    c++;
    return;
  }

  let ans = 0;
  const arr = d.split('').map(Number);
  let inc = 0;

  for (let i = arr.length; i >= 0; i--) {
    if (arr[i] % 2 === 0) {
      inc++;
    }

    ans += inc;
  }

  console.log(ans);

  c++;
});

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){
	return {
		list : input, index : 0, max : input.length,
		hasNext : function(){return (this.index < this.max);},
		next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
	};
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
	var N = nextInt();
	var list = nextCharArray();
	var output = 0;
	for(var i = 0; i < N; i++){
		if(myconv(list[i], 1) % 2 == 0){
			output += i + 1;
		}
	}
	myout(output);
}

var n = readline();
var a = readline().split('');
var res = 0;
for(var i=0; i<n; i++){
    if(a[i]%2==0){
        res+=i+1;
    }
}
print(res);

// var stats = readline().split(' ').map(function(num) {
//   return parseInt(num);
// })

readline();
var num = readline();
// var num = '1234'
var position = 1;
var global = 0;
for (var i = 0; i < num.length; i++) {
  if (parseInt(num[i]) % 2 === 0) {
    global += position;
  }

  position++;
}

write(global + '');

var readline = require('readline');
rl = readline.createInterface({
  input:process.stdin,
  output:process.stdout
})

rl.question('', (answer) => {
  var n = answer,k = 0,count=0
  rl.question('',(line) =>  {
    var str = line;
    for(var i=0;i<str.length;i++){
      if(str[i]%2==0){
        count = i + 1
        k+=count
      }
    }
    console.log(k)
    rl.close()
  })
})

const readline = require('readline');

const rl = readline.createInterface({
	input: process.stdin,
	setEncoding: 'utf8',
	terminal: false
});

const readInput = (function* () {
	const n = Number(yield);
	const s = (yield).trim().split("").map(Number);
	rl.close();
	let x = 0;
	for (let i = n; i > 0; i--) {
		if (s[i - 1] % 2 === 0) x += i;
	}
	console.log(x)
})();

readInput.next();

rl.on('line', (line) => {
	readInput.next(line);
});

var readline = require('readline');
rl = readline.createInterface({
  input:process.stdin,
  output:process.stdout
})

rl.question('', (answer) => {
  var n = answer,k = 0,r = 0,i = 0
  rl.question('',(line) =>  {
    var str = line;
    var string='';
      while(string != str[str.length-1]) {
        if(string==str[i]){
          i++;
          r=0
        }
        string = str.substring(i,str.length-r)
        if (+string%2==0) {
          k++
        }
      r++
    }
    if(str[str.length-1]==str[str.length-2]){
      k++
    }
    console.log(k)
    rl.close()
  })
})

var n = readline();
var string = readline().substring(0,n);

if(/[1-9]*/.test(string)){
var cnt=0;
for(var i=0; i<string.length; i++){
    for(var j=i; j<string.length; j++){
        if(string.substring(i,j)%2===0) cnt++;
    }
}
print(cnt);
}

var n = readline();
var string = readline().substring(0,n);

var cnt=0;
for(var i=0; i<string.length; i++){
    for(var j=i; j<string.length; j++){
        if(string.substring(i,j)%2==0) cnt++;
    }
}
print(cnt);

var n = readline();
var string = readline().substring(0,n);

var cnt=0;
for(var i=0; i<string.length; i++){
    for(var j=i; j<string.length; j++){
        if(string.substring(i,j)%2===0) cnt++;
    }
}
print(cnt);

var n = readline();
var string = readline().substring(0,n);
if(!/[1-9]+/.test(string) || n<1 || n>65000) exit();
var cnt=0;
for(var i=0; i<string.length; i++){
    for(var j=i; j<string.length; j++){
        if(string.substring(i,j)%2==0) cnt++;
    }
}
print(cnt);

var n = readline();
var string = readline().substring(0,n);

if(/[0-9]*/.test(string)){
var cnt=0;
for(var i=0; i<string.length; i++){
    for(var j=i; j<string.length; j++){
        if(string.substring(i,j)%2===0) cnt++;
    }
}
print(cnt);
}

var n = readline();
var string = readline().substring(0,n);

var cnt=0;
for(var i=0; i<string.length; i++){
    for(var j=i; j<string.length; j++){
        if(string.substring(i,j)%2==='0') cnt++;
    }
}
print(cnt);

// var stats = readline().split(' ').map(function(num) {
//   return parseInt(num);
// })

readline();
var num = readline();
// var num = '1234'
var position = 1;
var global = 0;
for (var i = 0; i < num.length; i++) {
  if (parseInt(num[i]) % 2 === 0) {
    global += position;
  }

  position++;
}

write(global = '');

// var stats = readline().split(' ').map(function(num) {
//   return parseInt(num);
// })

readline();
var num = readline();
// var num = '1234'
var position = 1;
var global = 0;
for (var i = 0; i < num.length; i++) {
  if (parseInt(num[i]) % 2 === 0) {
    global += position;
  }

  position++;
}

// console.log(global);


///////////////////////////////// pre-define ////////////////////////////////////////////////////////////////////////////////
const pr = console.log;
const mi = Math.min;
const mx = Math.max;
const mxll = (...args) => args.reduce((m, e) => e > m ? e : m);
const mill = (...args) => args.reduce((m, e) => e < m ? e : m);
const sqll = (v) => { if (v < 0n) throw 'negative input'; if (v < 2n) return v; const dfs = (n, x0) => { let x1 = ((n / x0) + x0) >> 1n; if (x0 === x1 || x0 === (x1 - 1n)) return x0; return dfs(n, x1); }; return dfs(v, 1n); }; // has >> 0
const abs = Math.abs;
const fl = Math.floor;
const ce = Math.ceil;
const sq = Math.sqrt;
const lge = Math.log;
const lg10 = Math.log10;
const ll = BigInt;
const combination = (m, n) => { return factorial(m, n) / factorial(n, n); };
const factorial = (m, n) => { let num = 1n; let cnt = 0; for (let i = ll(m); i > 0; i--) { if (cnt == n) break; num *= i; cnt++; } return num; };
const gcd = (a, b) => b == 0 ? a : gcd(b, a % b);
const lcm = (a, b) => (a / gcd(a, b)) * b;
const bitCount = (n) => { n = n - ((n >> 1) & 0x55555555); n = (n & 0x33333333) + ((n >> 2) & 0x33333333); return ((n + (n >> 4) & 0xF0F0F0F) * 0x1010101) >> 24; };
const powmod = (a, b, mod) => { let r = 1n; while (b > 0n) { if (b % 2n == 1) r = r * a % mod; b >>= 1n; a = a * a % mod; } return r; };
const amax = (a) => mx.apply(Math, a);
const amin = (a) => mi.apply(Math, a);
const sm = (a) => a.reduce(((x, y) => x + y), 0);
const aeq = (a, b) => JSON.stringify(a) == JSON.stringify(b);
const swap = (a, i, j) => [a[i], a[j]] = [a[j], a[i]];
const stin = (a) => a.sort((x, y) => x - y);
const stde = (a) => a.sort((x, y) => y - x);
const sortPart = (a, k) => { let l = a.slice(0, k); l.sort((x, y) => x - y); let r = a.slice(k); return l.concat(r); }; // sort first kth
const initialize2DArrayNew = (m, n) => { let data = []; for (let i = 0; i < m; i++) { let tmp = Array(n).fill(0); data.push(tmp); } return data; };
const stmkey_in = (m) => new Map([...m].sort((x, y) => x[0] - y[0]));
const stmkey_de = (m) => new Map([...m].sort((x, y) => y[0] - x[0]));
const stmvalue_in = (m) => new Map([...m].sort((x, y) => x[1] - y[1]));
const stmvalue_de = (m) => new Map([...m].sort((x, y) => y[1] - x[1]));
const counter = (a_or_s) => { let map = new Map(); for (const i of a_or_s) map.set(i, map.get(i) + 1 || 1); return map; };
const counter_value_in_indexA_in = (a_or_s) => { let m = new Map(); let n = a_or_s.length; for (let i = 0; i < n; i++) { if (!m.has(a_or_s[i])) m.set(a_or_s[i], []); m.get(a_or_s[i]).push(i); } return m; };
const counter_value_in_indexA_de = (a_or_s) => { let m = new Map(); let n = a_or_s.length; for (let i = 0; i < n; i++) { if (!m.has(a_or_s[i])) m.set(a_or_s[i], []); m.get(a_or_s[i]).unshift(i); } return m; };
const reverse2 = (s) => { let res = ""; for (let i = s.length - 1; i >= 0; i--) { res += s[i]; } return res; };
const isPalindrome = (s) => { let n = s.length; let i = 0; let j = n - 1; while (i < j) { if (s[i++] != s[j--]) return false; } return true; };
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
 * 05/24/21 morning
 * https://codeforces.com/contest/1529/problem/A
 */
const solve = (n, a) => {
    let min = amin(a);
    let m = counter(a);
    let minC = m.get(min);
    // pr(n, a)
    pr(n - minC);
};

const main = () => {
    const readline = require('readline');
    const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    });
    let input = [];
    rl.on('line', (line) => {
        input.push(line.split(" ").map(x => Number(x)));
    });
    rl.on('close', () => {
        let t = input[0][0];
        let i = 1;
        while (t--) {
            solve(input[i][0], input[i + 1]);
            i += 2;
        }
    });
};

main()

const solve = (line) => {
	const arr = line.split(' ').map(v => +v);
	const min = Math.min(...arr);

	return arr.filter(item => item !== min).length;
}

let input = '';
process.stdin.on('data', str => input += str)
process.stdin.on('end', () => {
	const [n, ...lines] = input.trim().split('\n')
		.map(l => l.trim());

	for (let i=0; i<n; i++) {
		console.log(solve(lines[(i*2)+1]));
	}
})

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = []; var outputList = [];var retcode = new Set();
read.on('line', function(input){
	var tmp = input.split(' ');
	for(var i = 0; i < tmp.length; i++){
		inLine.push(tmp[i]);
		if(i == tmp.length - 1){
			retcode.add(inLine.length);
		}
	}
});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
	console.log(myconv(outputList, 9));
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextArray(size, code){
	var ret = new Array(size);
	for(var i = 0; i < size; i++){
		if(code == 'int'){
			ret[i] = nextInt();
		}else if(code == 'long'){
			ret[i] = BigInt(next());
		}else{
			ret[i] = next();
		}
	}
	return ret;
}
function nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');} function nextLongArray(size){return nextArray(size, 'long');}
function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);} function nextLong(){return BigInt(next());}
function getCountMap(list){
	var map = {};
	for(var i = 0; i < list.length; i++){
		if(map[list[i]] == null){
			map[list[i]] = 0;
		}
		map[list[i]]++;
	}
	return map;
}
function init(input){
	return {
		list : input, index : 0, max : input.length,
		hasNext : function(){return (this.index < this.max);},
		next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}},
		isReturn : function(){return retcode.has(this.index);}
	};
}
function myout(s){outputList.push(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
function isReturn(){return obj.isReturn();}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
	var t = nextInt();
	while(hasNext()){
		var N = nextInt();
		var list = nextIntArray(N);
		var map = getCountMap(list);
		var keys = Object.keys(map);
		keys.sort(function(a,b){
			return a - b;
		});
		myout(N - map[keys[0]]);
	}
}

function main(input) {
  let arr = input.split("\n");
  let testCases = arr[0];

  // Begin Coding

  for ( let i= 2; i < arr.length; i+=2) {

    let eshagArray= arr[i]
    eshagArray = eshagArray.split(" ").map(num => {
    return Number(num)
  })
    let removedElements = applyEshag(eshagArray)
  console.log(removedElements)
  }

}

function applyEshag(eshagArray) {
  let minValue= eshagArray[0];
 let wantedArray = [...eshagArray]
  for (let number of eshagArray) {

    if (number <= minValue) {
      minValue = number
    }
  }
  wantedArray = wantedArray.filter(el => el > minValue)

  return wantedArray.length

}

process.stdin.resume();
process.stdin.setEncoding("utf-8");
var stdin_input = "";

process.stdin.on("data", function (input) {
    stdin_input += input;
});

process.stdin.on("end", function () {
   main(stdin_input);
});

'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var os = require('os');

const stdin = process.stdin;
const stdout = process.stdout;
class InputAndOutput {
    constructor() {
        this.lineIndex = 0;
        this.lines = [];
    }
    dried() {
        return this.lineIndex >= this.lines.length;
    }
    readLine() {
        const line = this.lines[this.lineIndex];
        this.lineIndex += 1;
        return line;
    }
    print(content) {
        stdout.write(content);
    }
    async init() {
        const lines = await this.readLines();
        this.lines = lines;
    }
    readLines() {
        const buffers = [];
        return new Promise(resolve => {
            stdin.on('data', (buffer) => buffers.push(buffer));
            stdin.on('end', function () {
                const inputs = buffers.join('');
                const lines = inputs.split(os.EOL);
                resolve(lines);
            });
        });
    }
}
async function __main__(handle) {
    const io = new InputAndOutput();
    await io.init();
    handle(io);
}

function solutionA(nums) {
    nums.sort((x, y) => x - y);
    for (let i = 1; i < nums.length; ++i) {
        if (nums[i] > nums[i - 1])
            return nums.length - i;
    }
    return 0;
}
__main__(function (io) {
    const T = Number(io.readLine());
    for (let kase = 1; kase <= T; ++kase) {
        const countOfNums = Number(io.readLine());
        const nums = io
            .readLine()
            .trim()
            .split(/\s+/g)
            .map(x => Number(x))
            .slice(0, countOfNums);
        const answer = solutionA(nums);
        io.print('' + answer + '\n');
    }
});

'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var os = require('os');

const stdin = process.stdin;
const stdout = process.stdout;
class InputAndOutput {
    constructor() {
        this.lineIndex = 0;
        this.lines = [];
    }
    dried() {
        return this.lineIndex >= this.lines.length;
    }
    readLine() {
        const line = this.lines[this.lineIndex];
        this.lineIndex += 1;
        return line;
    }
    print(content) {
        stdout.write(content);
    }
    async init() {
        const lines = await this.readLines();
        this.lines = lines;
    }
    readLines() {
        const buffers = [];
        return new Promise(resolve => {
            stdin.on('data', (buffer) => buffers.push(buffer));
            stdin.on('end', function () {
                const inputs = buffers.join('');
                const lines = inputs.split(os.EOL);
                resolve(lines);
            });
        });
    }
}
async function __main__(handle) {
    const io = new InputAndOutput();
    await io.init();
    handle(io);
}

function solutionA(nums) {
    nums.sort((x, y) => x - y);
    for (let i = 1; i < nums.length; ++i) {
        if (nums[i] > nums[i - 1])
            return nums.length - i;
    }
    return 0;
}
__main__(function (io) {
    const T = Number(io.readLine());
    for (let kase = 1; kase <= T; ++kase) {
        Number(io.readLine());
        const nums = io.readLine().split(/\s+/g).map(x => Number(x));
        const answer = solutionA(nums);
        io.print('' + answer + '\n');
    }
});

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL); /*your input text, split by lines*/
    var n = lines[0], e = 0
    for(j = 1; j <= n*2; j++){
        if(j % 2 === 1){
            e = lines[j], a = new Map()
        }else{
            k = lines[j].split(' ').map(Number).sort(function(a, b){return a - b}),
            small = k[0], s = 0
            for(l = 0; l < e; l++){
                if(a.has(k[l])){
                    tp = a.get(k[l])
                    tp++
                    a.set(k[l], tp)
                }else{
                    a.set(k[l], 1)
                }
            }
            var biggestKey = ''
            var biggestValue = 0
            for(var[key, value] of a){
                if(key != small){
                s+=value
                }
            }
            console.log(s)

        }

    }

});

let data = '';
process.stdin.on('data', c => data += c);

function* nextLine() {
	let lines = data.trim().split(/\n/g);
	for(let l of lines){
		yield l.trim();
	}
}

let nl = nextLine();

nl.elem = function(funParse) {
		return funParse(this.next().value);
	};

nl.array = function(funParse) {
		return this.next().value.split(/\s/g).map(funParse||(x => x));
	};

nl.num = function() {
		return nl.elem(Number);
	};

nl.nums = function() {
		return nl.array(Number);
	};

nl.line = function() {
		return this.next().value;
	};

const sol = () => {
	//your code this
	let t = nl.num();
	let ans = [];
	for(let i = 0 ; i < t; i++){
		let n = nl.num();
		let a = nl.nums();
		let m = a.reduce((ac, e) => e<ac?e:ac, a[0]);
		ans.push(n - a.reduce((ac, e) => e == m?(ac+1):ac, 0));
	}
	console.log(ans.join('\n'));
};

process.stdin.on('end', sol);

let data = '';
process.stdin.on('data', c => data += c);

function* nextLine() {
	let lines = data.trim().split(/\n/g);
	for(let l of lines){
		yield l.trim();
	}
}

let nl = nextLine();

nl.elem = function(funParse) {
		return funParse(this.next().value);
	};

nl.array = function(funParse) {
		return this.next().value.split(/\s/g).map(funParse||(x => x));
	};

nl.num = function() {
		return nl.elem(Number);
	};

nl.nums = function() {
		return nl.array(Number);
	};

nl.line = function() {
		return this.next().value;
	};

const sol = () => {
	//your code this
	let t = nl.num();
	let ans = [];
	for(let i = 0 ; i < t; i++){
		let n = nl.num();
		let a = nl.nums();
		let m = Math.min(...a);
		ans.push(n - a.reduce((ac, e) => e == m?(ac+1):ac, 0));
	}
	console.log(ans.join('\n'));
};

process.stdin.on('end', sol);

const fs = require('fs')

const inputs = fs.readFileSync(0).toString().split('\n');

function deleteElementsFromArr(arr = [], count = 0) {
    if (!arr.length) return count;
    const avg = arr.reduce((sum, cur) => sum + cur, 0) / arr.length;
    const max = Math.max(...arr);
    if (max > avg) {
        const newArr = arr.filter(el => el !== max);
        return deleteElementsFromArr(newArr, (arr.length - newArr.length) + count);
    }
    return count;
}

function main() {
    for (let i = 2; i < inputs.length; i += 2) {
        const arr = inputs[i].split(" ").map(e => +e);
        const count = deleteElementsFromArr(arr);
        console.log(count);

    }
}

main();

let q = '';
process.stdin.on('data', c => q += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = q.split(EOL);
    var t = lines[0];
    var e = 0;
    for(i = 1; i <= t * 2; i++){
        if(i % 2 == 1){
            e = lines[i];
        }else{
            var k = lines[i].split(' ').map(Number).sort(function(a, b){return a - b});
            var ans = 0;
            var a = k[0];
            for(j = 1; j < e; j++){
                if(k[j] > a){
                    ans++;
                }
            }
            console.log(ans);
        }
    }
});

process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});
function readLine() {
    return inputString[currentLine++];
};
process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });
    main();
    // cmd(not powershell): node cp.js < input.txt
});

function main() {
    let t = parseInt(readLine());
    while (t-- > 0) {
        solve();
    }
}
function solve() {
    let len = readLine();
    let arr = readLine().split(" ").map(i => parseInt(i)).sort((a, b) => a - b);
    let count = 1;
    for (let i = 1; i < len; i++) {
        if (arr[0] == arr[i]) count++;
        else break;
    }
    console.log(arr.length - count);
}

const rl = require("readline").createInterface({
    input: process.stdin,
    output: process.stdout
});

let lines = [];
let lineIdx = 0;

rl.on("line", line => {
    lines.push(line);
});

rl.on("close", () => {
    main();
});

function readLine() {
    return lines[lineIdx++];
}

function main() {
    let t = +readLine();
    while (t--) {
        let n = +readLine();
        let a = readLine().split(' ').map(x => +x).sort((x, y) => x - y);
        let i = 0;
        while (i < n && a[0] == a[i])
            i++;
        console.log(n - i);
    }
}

let i = '';
process.stdin.on('data', (c) => (i += c));
process.stdin.on('end', () => {
  const { EOL } = require('os');
  const lines = i.split(EOL);
  const N = parseInt(lines[0]);
  const arrays = [];
  const arrMin = [];
  let min = 999999;
  let result = 0;

  for (let i = 2; i < lines.length; i += 2) {
    arrays.push(lines[i].split(' ').map((n) => parseInt(n)));
  }

  for (let arr of arrays) {
    min = 999999;
    for (let num of arr) {
      min = Math.min(num, min);
    }
    arrMin.push(min);
  }
  for (let j = 0; j < arrays.length; j++) {
    result = 0;
    for (let i = 0; i < arrays[j].length; i++) {
      if (arrays[j][i] > arrMin[j]) {
        result += 1;
      }
    }
    console.log(result);
  }
});

const nextString = (function() {
  const listeners = [], strings = [], ps = process.stdin
  let last = ''
  ps.setEncoding('utf8')
  ps.on('readable', () => {
    let chunk
    while ((chunk = ps.read()) !== null) {
      chunk = (last + chunk).split(/\r\n|\r|\n/)
      last = chunk[chunk.length - 1]
      for (let i = 0; i < chunk.length - 1; ++i) {
        if (chunk[i].length > 0) {
          if (listeners.length > 0) {
            listeners.shift(1)(chunk[i])
          }
          else {
            strings.push(chunk[i])
          }
        }
      }
    }
  })
  const fn = resolve => {
    if (strings.length > 0) {
      resolve(strings.shift(1))
    }
    else {
      listeners.push(resolve)
    }
  }
  return () => new Promise(fn)
})()

async function proc() {
  let n = +await nextString();
  let mas = (await nextString()).split(' ').map(x => +x)
  let min = Math.min(...mas)
  let ans = 0
  for (let i = 0; i < n; ++i) {
    if (mas[i] > min) {
      ++ans
    }
  }
  console.log(ans)
}

async function main() {
  let t = +await nextString()
  for (let i = 0; i < t; ++i) {
    await proc()
  }
}

main()

function main(input) {
  let arr = input.split("\n");
  let testCases = arr[0];

  // Begin Coding

  for ( let i= 2; i < arr.length; i+=2) {

    let eshagArray= arr[i]
    eshagArray = eshagArray.split(" ").map(num => {
    return Number(num)
  })
    let removedElements = applyEshag(eshagArray)
   console.log(removedElements)
  }

}

function applyEshag(eshagArray) {
  let avg = null;
  for (let number of eshagArray) {
    avg += number
  }
  avg = avg/eshagArray.length
  let subSequenceFiltered = eshagArray.filter(el => el < avg)
  if (subSequenceFiltered.length === 0) {
    return 0;
  } else {
  return eshagArray.length - subSequenceFiltered.length
  }
}

process.stdin.resume();
process.stdin.setEncoding("utf-8");
var stdin_input = "";

process.stdin.on("data", function (input) {
    stdin_input += input;
});

process.stdin.on("end", function () {
   main(stdin_input);
});

function main(input) {
  let arr = input.split("\n")
  let testCases = arr[0]
  let arrayLength = arr[1]
  let eshagArray = arr[2]
  eshagArray = eshagArray.split(" ").map(num => {
    return Number(num)
  })

  let removedElements = applyEshag(eshagArray)
  // return removedElements
  // process.stdout.write(removedElements)
  console.log(removedElements)

}

function applyEshag(eshagArray) {
  let subSequence = eshagArray.slice(1,4);
  let avg = null;

  for (let number of eshagArray) {
    avg += number
  }
  avg = avg/eshagArray.length
  let subSequenceFiltered = eshagArray.filter(el => el < avg)
  // console.log('average',avg)
  // console.log('new',subSequenceFiltered)
  const test = eshagArray.length - subSequenceFiltered.length
  if (subSequenceFiltered.length === 0) {
    return 0;
  } else {
  return eshagArray.length - subSequenceFiltered.length
  }
}

process.stdin.resume();
process.stdin.setEncoding("utf-8");
var stdin_input = "";

process.stdin.on("data", function (input) {
    stdin_input += input;
});

process.stdin.on("end", function () {
   main(stdin_input);
});

function main(input) {
  let arr = input.split("\n")
  let testCases = arr[0]
  let arrayLength = arr[1]
  let eshagArray = arr[2]
  eshagArray = eshagArray.split(" ").map(num => {
    return Number(num)
  })

  let removedElements = applyEshag(eshagArray)
  return removedElements
  // console.log('final result',removedElements)

}

function applyEshag(eshagArray) {
  let subSequence = eshagArray.slice(1,4);
  let avg = null;

  for (let number of eshagArray) {
    avg += number
  }
  avg = avg/eshagArray.length
  let subSequenceFiltered = eshagArray.filter(el => el < avg)
  // console.log('average',avg)
  // console.log('new',subSequenceFiltered)
  const test = eshagArray.length - subSequenceFiltered.length
  if (subSequenceFiltered.length === 0) {
    return 0;
  } else {
  return eshagArray.length - subSequenceFiltered.length
  }
}

process.stdin.resume();
process.stdin.setEncoding("utf-8");
var stdin_input = "";

process.stdin.on("data", function (input) {
    stdin_input += input;
});

process.stdin.on("end", function () {
   main(stdin_input);
});

function main(input) {
  let arr = input.split("\n")
  let testCases = arr[0]
  let arrayLength = arr[1]
  let eshagArray = arr[2]
  eshagArray = eshagArray.split(" ").map(num => {
    return Number(num)
  })

  let removedElements = applyEshag(eshagArray)
  // console.log('final result',removedElements)

}

function applyEshag(eshagArray) {
  let subSequence = eshagArray.slice(1,4);
  let avg = null;

  for (let number of eshagArray) {
    avg += number
  }
  avg = avg/eshagArray.length
  let subSequenceFiltered = eshagArray.filter(el => el < avg)
  // console.log('average',avg)
  // console.log('new',subSequenceFiltered)
  const test = eshagArray.length - subSequenceFiltered.length
  if (subSequenceFiltered.length === 0) {
    return 0;
  } else {
  return eshagArray.length - subSequenceFiltered.length
  }
}

process.stdin.resume();
process.stdin.setEncoding("utf-8");
var stdin_input = "";

process.stdin.on("data", function (input) {
    stdin_input += input;
});

process.stdin.on("end", function () {
   main(stdin_input);
});

'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var os = require('os');

const stdin = process.stdin;
const stdout = process.stdout;
class InputAndOutput {
    constructor() {
        this.lineIndex = 0;
        this.lines = [];
    }
    dried() {
        return this.lineIndex >= this.lines.length;
    }
    readLine() {
        const line = this.lines[this.lineIndex];
        this.lineIndex += 1;
        return line;
    }
    print(content) {
        stdout.write(content);
    }
    async init() {
        const lines = await this.readLines();
        this.lines = lines;
    }
    readLines() {
        const buffers = [];
        return new Promise(resolve => {
            stdin.on('data', (buffer) => buffers.push(buffer));
            stdin.on('end', function () {
                const inputs = buffers.join('');
                const lines = inputs.split(os.EOL);
                resolve(lines);
            });
        });
    }
}
async function __main__(handle) {
    const io = new InputAndOutput();
    await io.init();
    handle(io);
}

function solutionA(nums) {
    nums.sort((x, y) => x - y);
    for (let i = 1; i < nums.length; ++i) {
        if (nums[i] > nums[i - 1])
            return nums.length - i;
    }
    return 0;
}
__main__(function (io) {
    const T = Number(io.readLine());
    for (let kase = 1; kase <= T; ++kase) {
        Number(io.readLine());
        const nums = io.readLine().split(/\s*/g).map(x => Number(x));
        const answer = solutionA(nums);
        io.print('' + answer + '\n');
    }
});

'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var os = require('os');

const stdin = process.stdin;
const stdout = process.stdout;
class InputAndOutput {
    constructor() {
        this.lineIndex = 0;
        this.lines = [];
    }
    dried() {
        return this.lineIndex >= this.lines.length;
    }
    readLine() {
        const line = this.lines[this.lineIndex];
        this.lineIndex += 1;
        return line;
    }
    print(content) {
        stdout.write(content);
    }
    async init() {
        const lines = await this.readLines();
        this.lines = lines;
    }
    readLines() {
        const buffers = [];
        return new Promise(resolve => {
            stdin.on('data', (buffer) => buffers.push(buffer));
            stdin.on('end', function () {
                const inputs = buffers.join('\n');
                const lines = inputs.split(os.EOL);
                resolve(lines);
            });
        });
    }
}
async function __main__(handle) {
    if (process.env.GUANGHECHEN_LOCAL)
        return;
    const io = new InputAndOutput();
    await io.init();
    handle(io);
}

function solutionA(nums) {
    nums.sort((x, y) => x - y);
    for (let i = 1; i < nums.length; ++i) {
        if (nums[i] > nums[i - 1])
            return nums.length - i;
    }
    return 0;
}
__main__(function (io) {
    const T = Number(io.readLine());
    for (let kase = 1; kase <= T; ++kase) {
        Number(io.readLine());
        const nums = io.readLine().split('').map(x => Number(x));
        const answer = solutionA(nums);
        io.print('' + answer + '\n');
    }
});

exports.default = solutionA;

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var n = lines[0],e=0, k = 0
    for(j = 1; j <= n *2; j++){
        if(j % 2 == 1){
            e = lines[j],a = new Map()
        }else{
            k = lines[j].split(' ').map(Number)
            for(l = 0; l < e; l++){
                if(a.has(k[l])){
                    ut = a.get(k[l])
                    ut++
                    a.set(k[l], ut)
                }else{
                    a.set(k[l], 1)
                }
            }
            var biggestValue = 0
            for(var[key, value] of a){
                if(value > biggestValue){
                    biggestValue=value
                }
            }
            console.log(Number(e - biggestValue))
        }
    }

});

const fs = require('fs')

const inputs = fs.readFileSync(0).toString().split('\n');

function deleteElementsFromArr(arr = [], count = 0) {
    if (!arr.length) return count;
    const avg = arr.reduce((sum, cur) => sum + cur, 0) / arr.length;
    const newArr = arr.filter(el => el <= avg);
    if (newArr.length !== arr.length) return deleteElementsFromArr(newArr, (arr.length - newArr.length));
    return count;
}

function main() {
    for (let i = 2; i < inputs.length; i += 2) {
        const arr = inputs[i].split(" ").map(e => +e);
        const count = deleteElementsFromArr(arr);
        console.log(count);

    }
}

main();


var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

function main () {
	let T = rn();
	while (T--) {
		let [n, x] = rna();
		let a = rna();
		let j = x - 1, i = n - x;

		let b = a.slice();
		b.sort((x, y) => x - y);

		let ans = true;
		for (let k = i; k <= j; k++) {
			ans = ans && a[k] == b[k];
		}

		console.log(ans ? 'YES' : 'NO');
	}
}

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = +lines[l++]
    for (let i = 0; i < t; i++) {
        const [n, x] = lines[l++].trim().split(' ').map(Number)
        const arr = lines[l++].trim().split(' ').map(Number)
        console.log(solve(n, x, arr))
    }
// })()
})

function solve(n, x, arr) {
    const sorted = arr.slice().sort((a, b) => a - b)
    for (let i = 0; i < arr.length; i++) {
        if (i + x >= n && i - x < 0 && arr[i] !== sorted[i]) {
            return 'NO'
        }
    }
    return 'YES'
}

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
const solve = () => {
  let t = parseInt(readline());
  while (t--) {
    let [n, x] = readline()
      .trim()
      .split(" ")
      .map((cur) => parseInt(cur));
    let arr = readline()
      .trim()
      .split(" ")
      .map((cur) => parseInt(cur));

    let ans = true;
    for (let i = 0; i < n - 1; i++) {
      if (arr[i] > arr[i + 1]) {
        ans = false;
        break;
      }
    }
    if (ans) console.log("YES");
    else {
      ans = true;
      let narr = [...arr];
      narr.sort((a, b) => a - b);
      let bool = new Array(n).fill(false);
      for (let i = 0; i < n; i++) {
        if (!bool[i]) {
          for (let j = i + x; j < n; j++) {
            if (bool[j] === true) {
              bool[i] = true;
              break;
            }
            if (j - i >= x) {
              bool[i] = true;
              bool[j] = true;
            }
          }
        }
      }
      for (let i = 0; i < n; i++) {
        if (!bool[i]) {
          if (narr[i] !== arr[i]) {
            ans = false;
            break;
          }
        }
      }
      if (ans) console.log("YES");
      else console.log("NO");
    }
  }
};
solve();

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

function main () {
	let t = rn();
	let cnt = 0;
	while (t--) {
		let [n, x] = rna();
		let a = rna();

		cnt ++;
		if (cnt == 48) {
			console.log(n, x) ;
			console.log(a);
		}
		const k = n - x;

		if (2 * k >= n) {
			console.log('YES');
			continue;
		}

		let sorted = true;
		for (let i = k + 1; sorted && i < n - k; i++) {
			if (a[i] < a[i - 1]) sorted = false;
		}
		if (!sorted) {
			console.log('NO');
			continue;
		}

		let lcnt = 0, l = a[k];
		for (let i = 0; i < k; i++) {
			if (a[i] <= l) lcnt++;
			if (a[n-1-i] <= l) lcnt++;
		}

		ans = lcnt == k ? 'YES' : 'NO';
		console.log(ans);
	}
}

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

function main () {
	let t = rn();
	while (t--) {
		let [n, x] = rna();
		let a = rna();

		const k = n - x;

		if (2 * k >= n) {
			console.log('YES');
			continue;
		}

		let sorted = true;
		for (let i = k + 1; sorted && i < n - k;  i++) {
			if (a[i] < a[i - 1]) sorted = false;
		}
		if (!sorted) {
			console.log('NO');
			continue;
		}

		let lcnt = 0, l = a[k];
		for (let i = 0; i < k; i++) {
			if (a[i] <= l) lcnt++;
			if (a[n-1-i] <= l) lcnt++;
		}

		ans = lcnt == k ? 'YES' : 'NO';
		console.log(ans);
	}
}


var nums = readline().split(" ").map(function(x) { return parseInt(x); });
var n = nums[0];
var AAA = readline().split(" ").map(function(x) { return parseInt(x); });

var init_cnt = Array(3).fill(0);
for (var i=0; i<n; i++) init_cnt[AAA[i]]++;

var e = Array(n).fill([]);
for (var i=0; i<n; i++) {
    var t = [];
    e[i] = t;
}
var AA = [], BB = [];
for (var i=0; i<n-1; i++) {
	var qq = readline().split(" ").map(function(x) { return parseInt(x); });
	var a = qq[0], b = qq[1];
	a--; b--;
	e[a].push(b);
	e[b].push(a);
	AA.push(a);
	BB.push(b);
}

var sv = Array(n).fill(0);   // saved positions of list search on "dfs" next call
var nnew = Array(n).fill(0);
var cnt = Array(n).fill([]);   // recalc answer array for each vertex
for (var i=0; i<n; i++) {
	var t = Array(3).fill(0);
	cnt[i] = t;
}
var st = [];   // stack
st.push(0);
while (st.length > 0) {
	var v = st[st.length-1];
	nnew[v] = 1;
	var fnd = 0;
	for (var i=sv[v]; i<e[v].length; i++)
		if (!nnew[e[v][i]]) {
			sv[v] = i+1;
			st.push(e[v][i]);
			fnd = 1;
			break;
		}
	if (fnd === 1) continue;
	sv[v] = e[v].length;
	for (var i=0; i<e[v].length; i++)
		for (var j=0; j<3; j++)
			cnt[v][j] += cnt[e[v][i]][j];
	cnt[v][AAA[v]]++;
	st.pop();
}

var ans = 0;
var used = Array(n).fill(0);
for (var i=0; i<n-1; i++) {
	var a = AA[i];
	var b = BB[i];

	var fnd = 0, sub = 0;
	if ((cnt[a][2] === 0 && cnt[a][1] === init_cnt[1]) ||
	    (cnt[a][1] === 0 && cnt[a][2] === init_cnt[2])) {
		fnd = 1;
		sub = a;
	}
	if (fnd === 1 && !used[sub]) {
		used[sub] = 1;
		ans++;
	}

	if ((cnt[b][2] === 0 && cnt[b][1] === init_cnt[1]) ||
	    (cnt[b][1] === 0 && cnt[b][2] === init_cnt[2])) {
		fnd = 1;
		sub = b;
	}
	if (fnd === 1 && !used[sub]) {
		used[sub] = 1;
		ans++;
	}
}

write(ans);

var nums = readline().split(" ").map(function(x) { return parseInt(x); });
var n = nums[0];
var AAA = readline().split(" ").map(function(x) { return parseInt(x); });

var init_cnt = Array(3).fill(0);
for (var i=0; i<n; i++) init_cnt[AAA[i]]++;

var ms = Array(n).fill([]);
for (var i=0; i<n; i++) {
    var t = [];
    ms[i] = t;
}
var AA = [], BB = [];
for (var i=0; i<n-1; i++) {
	var qq = readline().split(" ").map(function(x) { return parseInt(x); });
	var a = qq[0], b = qq[1];
	a--; b--;
	ms[a].push(b);
	ms[b].push(a);
	AA.push(a);
	BB.push(b);
}

var sv = Array(n).fill(0);
var nnew = Array(n).fill(0);
var cnt = Array(n).fill([]);
for (var i=0; i<n; i++) {
	var t = Array(3).fill(0);
	cnt[i] = t;
}

var st = [];
st.push(0);
while (st.length > 0) {
	var v = st[st.length-1];
	nnew[v] = 1;
	var fnd = 0;
	for (var i=sv[v]; i<ms[v].length; i++)
		if (!nnew[ms[v][i]]) {
			sv[v] = i+1;
			st.push(ms[v][i]);
			fnd = 1;
			break;
		}
	if (fnd === 1) continue;
	sv[v] = ms[v].length;
	for (var i=0; i<ms[v].length; i++)
		for (var j=0; j<3; j++)
			cnt[v][j] += cnt[ms[v][i]][j];
	cnt[v][AAA[v]]++;
	st.pop();
}

// write(init_cnt,"\n");
// for (var i=0; i<n; i++) {
// 	write("V ",i," ");
// 	write(cnt[i],"\n");
// }

var ans = 0;
var used = Array(n).fill(0);
for (var i=0; i<n-1; i++) {
	var a = AA[i];
	var b = BB[i];

	var fnd = 0, sub = 0;
	if ((cnt[a][2] === 0 && cnt[a][1] === init_cnt[1]) ||
	    (cnt[a][1] === 0 && cnt[a][2] === init_cnt[2])) {
		fnd = 1;
		sub = a;
	}
	if (fnd === 1 && !used[sub]) {
		used[sub] = 1;
		ans++;
	}

	if ((cnt[b][2] === 0 && cnt[b][1] === init_cnt[1]) ||
	    (cnt[b][1] === 0 && cnt[b][2] === init_cnt[2])) {
		fnd = 1;
		sub = b;
	}
	if (fnd === 1 && !used[sub]) {
		used[sub] = 1;
		ans++;
	}
}

// if (n === 300000 && ans > 0) {
// 	write("init_cnt = ",init_cnt,"\n");
// 	write("sizes > 2");
// 	for (var i=0; i<n; i++)
// 		if (ms[i].length > 2)
// 			write(ms[i].length," ");
// 	for (var i=0; i<n-1; i++) {
// 		var a = AA[i];
// 		var b = BB[i];

// 		if ((cnt[a][2] === 0 && cnt[a][1] === init_cnt[1]) ||
// 		    (cnt[a][1] === 0 && cnt[a][2] === init_cnt[2]) ||
// 		    (cnt[b][2] === 0 && cnt[b][1] === init_cnt[1]) ||
// 		    (cnt[b][1] === 0 && cnt[b][2] === init_cnt[2]))
// 			write(" CNT_OK ", a," ",b," cnt_a = ", cnt[a],"[",AAA[a],"] cnt_b = ", cnt[b],"[",AAA[b],"]");
// 	}
// }

write(ans);

var nums = readline().split(" ").map(function(x) { return parseInt(x); });
var n = nums[0];
var AAA = readline().split(" ").map(function(x) { return parseInt(x); });

var init_cnt = Array(3).fill(0);
for (var i=0; i<n; i++) init_cnt[AAA[i]]++;

var ms = Array(n).fill([]);
for (var i=0; i<n; i++) {
    var t = [];
    ms[i] = t;
}
var AA = [], BB = [];
for (var i=0; i<n-1; i++) {
	var qq = readline().split(" ").map(function(x) { return parseInt(x); });
	var a = qq[0], b = qq[1];
	a--; b--;
	ms[a].push(b);
	ms[b].push(a);
	AA.push(a);
	BB.push(b);
}

var sv = Array(n).fill(0);
var nnew = Array(n).fill(0);
var cnt = Array(n).fill([]);
for (var i=0; i<n; i++) {
	var t = Array(3).fill(0);
	cnt[i] = t;
}

function getRandomInt(min, max) {
   min = Math.ceil(min);
   max = Math.floor(max);
   return Math.floor(Math.random() * (max - min + 1)) + min;
}

var st = [];
st.push(getRandomInt(0,n-1));
while (st.length > 0) {
	var v = st[st.length-1];
	nnew[v] = 1;
	var fnd = 0;
	for (var i=sv[v]; i<ms[v].length; i++)
		if (!nnew[ms[v][i]]) {
			sv[v] = i+1;
			st.push(ms[v][i]);
			fnd = 1;
			break;
		}
	if (fnd === 1) continue;
	sv[v] = ms[v].length + 1;
	for (var i=0; i<ms[v].length; i++)
		for (var j=0; j<3; j++)
			cnt[v][j] += cnt[ms[v][i]][j];
	cnt[v][AAA[v]]++;
	st.pop();
}

var ans = 0;
for (var i=0; i<n-1; i++) {
	var a = AA[i];
	var b = BB[i];

	if ((cnt[a][2] === 0 && cnt[a][1] === init_cnt[1]) ||
	    (cnt[a][1] === 0 && cnt[a][2] === init_cnt[2]) ||
	    (cnt[b][2] === 0 && cnt[b][1] === init_cnt[1]) ||
	    (cnt[b][1] === 0 && cnt[b][2] === init_cnt[2]))
		ans++;
}

write(ans);

var nums = readline().split(" ").map(function(x) { return parseInt(x); });
var n = nums[0];
var AAA = readline().split(" ").map(function(x) { return parseInt(x); });

var init_cnt = Array(3).fill(0);
for (var i=0; i<n; i++) init_cnt[AAA[i]]++;

var ms = Array(n).fill([]);
for (var i=0; i<n; i++) {
    var t = [];
    ms[i] = t;
}
var AA = [], BB = [];
for (var i=0; i<n-1; i++) {
	var qq = readline().split(" ").map(function(x) { return parseInt(x); });
	var a = qq[0], b = qq[1];
	a--; b--;
	ms[a].push(b);
	ms[b].push(a);
	AA.push(a);
	BB.push(b);
	//write("edge ",a," ",b,"\n");
}

//for (var i=0; i<n; i++) {
    //write(" vertex ",i,"  ");
    //for (var j=0; j<ms[i].length; j++) write(ms[i][j]," ");
    //write("\n");
//}

var sv = Array(n).fill(0);
var nnew = Array(n).fill(0);
var cnt = Array(n).fill([]);
for (var i=0; i<n; i++) {
	var t = Array(3).fill(0);
	cnt[i] = t;
}

var st = [];
st.push(0);
while (st.length > 0) {
//write("stk = ",st,"\n");
	var v = st[st.length-1];
	nnew[v] = 1;
	var fnd = 0;
	for (var i=sv[v]; i<ms[v].length; i++)
		if (!nnew[ms[v][i]]) {
		    //write("goto ",v," ",ms[v][i]);
			sv[v] = i+1;
			st.push(ms[v][i]);
			fnd = 1;
			break;
		}
	if (fnd === 1) continue;
	sv[v] = ms[v].length + 1;
	for (var i=0; i<ms[v].length; i++)
		for (var j=0; j<3; j++)
			cnt[v][j] += cnt[ms[v][i]][j];
	cnt[v][AAA[v]]++;
	//write(" ad to ", v, " ", a[v]);
	st.pop();
}

//write(init_cnt);
//write("\n\n");
//for (var i=0; i<n; i++) write(cnt[i],"\n");

var ans = 0;
for (var i=0; i<n-1; i++) {
	var a = AA[i];
	var b = BB[i];

	if ((cnt[a][2] === 0 && cnt[a][1] === init_cnt[1]) ||
	   (cnt[a][1] === 0 && cnt[a][2] === init_cnt[2]) ||
	   (cnt[b][2] === 0 && cnt[b][1] === init_cnt[1]) ||
	   (cnt[b][1] === 0 && cnt[b][2] === init_cnt[2]))
		ans++;
}

write(ans);

var nums = readline().split(" ").map(function(x) { return parseInt(x); });
var n = nums[0];
var AAA = readline().split(" ").map(function(x) { return parseInt(x); });

var init_cnt = Array(3).fill(0);
for (var i=0; i<n; i++) init_cnt[AAA[i]]++;

var ms = Array(n).fill([]);
for (var i=0; i<n; i++) {
    var t = [];
    ms[i] = t;
}
var AA = [], BB = [];
for (var i=0; i<n-1; i++) {
	var qq = readline().split(" ").map(function(x) { return parseInt(x); });
	var a = qq[0], b = qq[1];
	a--; b--;
	ms[a].push(b);
	ms[b].push(a);
	AA.push(a);
	BB.push(b);
}

var sv = Array(n).fill(0);
var nnew = Array(n).fill(0);
var cnt = Array(n).fill([]);
for (var i=0; i<n; i++) {
	var t = Array(3).fill(0);
	cnt[i] = t;
}

var st = [];
st.push(0);
while (st.length > 0) {
	var v = st[st.length-1];
	nnew[v] = 1;
	var fnd = 0;
	for (var i=sv[v]; i<ms[v].length; i++)
		if (!nnew[ms[v][i]]) {
			sv[v] = i+1;
			st.push(ms[v][i]);
			fnd = 1;
			break;
		}
	if (fnd === 1) continue;
	sv[v] = ms[v].length;
	for (var i=0; i<ms[v].length; i++)
		for (var j=0; j<3; j++)
			cnt[v][j] += cnt[ms[v][i]][j];
	cnt[v][AAA[v]]++;
	st.pop();
}

// write(init_cnt,"\n");
// for (var i=0; i<n; i++) {
// 	write("V ",i," ");
// 	write(cnt[i],"\n");
// }

var ans = 0;
for (var i=0; i<n-1; i++) {
	var a = AA[i];
	var b = BB[i];

	if ((cnt[a][2] === 0 && cnt[a][1] === init_cnt[1]) ||
	    (cnt[a][1] === 0 && cnt[a][2] === init_cnt[2]) ||
	    (cnt[b][2] === 0 && cnt[b][1] === init_cnt[1]) ||
	    (cnt[b][1] === 0 && cnt[b][2] === init_cnt[2]))
		ans++;
}

if (n === 300000 && ans > 0) {
	write("init_cnt = ",init_cnt,"\n");
	write("sizes > 2");
	for (var i=0; i<n; i++)
		if (ms[i].length > 2)
			write(ms[i].length," ");
	for (var i=0; i<n-1; i++) {
		var a = AA[i];
		var b = BB[i];

		if ((cnt[a][2] === 0 && cnt[a][1] === init_cnt[1]) ||
		    (cnt[a][1] === 0 && cnt[a][2] === init_cnt[2]) ||
		    (cnt[b][2] === 0 && cnt[b][1] === init_cnt[1]) ||
		    (cnt[b][1] === 0 && cnt[b][2] === init_cnt[2]))
			write(" CNT_OK ", a," ",b," cnt_a = ", cnt[a], " cnt_b = ", cnt[b]);
	}
}

write(ans);

var nums = readline().split(" ").map(function(x) { return parseInt(x); });
var n = nums[0];
var AAA = readline().split(" ").map(function(x) { return parseInt(x); });

var init_cnt = Array(3).fill(0);
for (var i=0; i<n; i++) init_cnt[AAA[i]]++;

var ms = Array(n).fill([]);
for (var i=0; i<n; i++) {
    var t = [];
    ms[i] = t;
}
var AA = [], BB = [];
for (var i=0; i<n-1; i++) {
	var qq = readline().split(" ").map(function(x) { return parseInt(x); });
	var a = qq[0], b = qq[1];
	a--; b--;
	ms[a].push(b);
	ms[b].push(a);
	AA.push(a);
	BB.push(b);
}

var sv = Array(n).fill(0);
var nnew = Array(n).fill(0);
var cnt = Array(n).fill([]);
for (var i=0; i<n; i++) {
	var t = Array(3).fill(0);
	cnt[i] = t;
}

var st = [];
st.push(0);
while (st.length > 0) {
	var v = st[st.length-1];
	nnew[v] = 1;
	var fnd = 0;
	for (var i=sv[v]; i<ms[v].length; i++)
		if (!nnew[ms[v][i]]) {
			sv[v] = i+1;
			st.push(ms[v][i]);
			fnd = 1;
			break;
		}
	if (fnd === 1) continue;
	sv[v] = ms[v].length;
	for (var i=0; i<ms[v].length; i++)
		for (var j=0; j<3; j++)
			cnt[v][j] += cnt[ms[v][i]][j];
	cnt[v][AAA[v]]++;
	st.pop();
}

// write(init_cnt,"\n");
// for (var i=0; i<n; i++) {
// 	write("V ",i," ");
// 	write(cnt[i],"\n");
// }

var ans = 0;
for (var i=0; i<n-1; i++) {
	var a = AA[i];
	var b = BB[i];

	if ((cnt[a][2] === 0 && cnt[a][1] === init_cnt[1]) ||
	    (cnt[a][1] === 0 && cnt[a][2] === init_cnt[2]) ||
	    (cnt[b][2] === 0 && cnt[b][1] === init_cnt[1]) ||
	    (cnt[b][1] === 0 && cnt[b][2] === init_cnt[2]))
		ans++;
}

if (n === 300000 && ans > 0) {
	write("init_cnt = ",init_cnt,"\n");
	write("sizes > 2");
	for (var i=0; i<n; i++)
		if (ms[i].length > 2)
			write(ms[i].length," ");
	for (var i=0; i<n-1; i++) {
		var a = AA[i];
		var b = BB[i];

		if ((cnt[a][2] === 0 && cnt[a][1] === init_cnt[1]) ||
		    (cnt[a][1] === 0 && cnt[a][2] === init_cnt[2]) ||
		    (cnt[b][2] === 0 && cnt[b][1] === init_cnt[1]) ||
		    (cnt[b][1] === 0 && cnt[b][2] === init_cnt[2]))
			write(" CNT_OK ", a," ",b," cnt_a = ", cnt[a],"[",AAA[a],"] cnt_b = ", cnt[b],"[",AAA[b],"]");
	}
}

write(ans);