## GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

## Tokitsukaze and All Zero Sequence Codeforces Solution | Codeforces Problem Solution 2022

A. Tokitsukaze and All Zero Sequence
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Tokitsukaze has a sequence $a$ of length $n$. For each operation, she selects two numbers ${a}_{i}$ and ${a}_{j}$ ($i\ne j$$1\le i,j\le n$).

• If ${a}_{i}={a}_{j}$, change one of them to $0$.
• Otherwise change both of them to $min\left({a}_{i},{a}_{j}\right)$.

Tokitsukaze wants to know the minimum number of operations to change all numbers in the sequence to $0$. It can be proved that the answer always exists.

[Solution] Tokitsukaze and Good 01-String

Tokitsukaze and Two Colorful Tapes Codeforces Solution

Tokitsukaze and Permutations Codeforces Solution

Input

The first line contains a single positive integer $t$ ($1\le t\le 1000$) — the number of test cases.

For each test case, the first line contains a single integer $n$ ($2\le n\le 100$) — the length of the sequence $a$.

The second line contains $n$ integers ${a}_{1},{a}_{2},\dots ,{a}_{n}$ ($0\le {a}_{i}\le 100$) — the sequence $a$.

Output

For each test case, print a single integer — the minimum number of operations to change all numbers in the sequence to $0$.

Note

In the first test case, one of the possible ways to change all numbers in the sequence to $0$:

In the $1$-st operation, ${a}_{1}<{a}_{2}$, after the operation, ${a}_{2}={a}_{1}=1$. Now the sequence $a$ is $\left[1,1,3\right]$.

In the $2$-nd operation, ${a}_{1}={a}_{2}=1$, after the operation, ${a}_{1}=0$. Now the sequence $a$ is $\left[0,1,3\right]$.

In the $3$-rd operation, ${a}_{1}<{a}_{2}$, after the operation, ${a}_{2}=0$. Now the sequence $a$ is $\left[0,0,3\right]$.

In the $4$-th operation, ${a}_{2}<{a}_{3}$, after the operation, ${a}_{3}=0$. Now the sequence $a$ is $\left[0,0,0\right]$.

So the minimum number of operations is $4$.