New update is available. Click here to update.

Last Updated: 11 Mar, 2021

Difficulty: Easy

```
1. If the current number of teams(N) playing in the tournament is even then, a total of N / 2 matches will be played. The winning N / 2 teams will advance to the next round, and the losing N / 2 teams will be eliminated.
2. If the current number of teams(N) playing in the tournament is odd then, 1 team will be advanced to the next round directly, and a total of (N - 1) / 2 matches will be played. The winning (N - 1) / 2 teams will advance to the next round, and the losing (N - 1) / 2 teams will be eliminated.
```

```
The first line contains an integer, ‘T,’ which denotes the number of test cases or queries to be run. Then, the T test cases follow.
The first and the only line of each test case contains one integer 'N', as described in the problem statement.
```

```
For each test case, print a single line containing a single integer denoting the total number of matches played in the tournament.
The output of each test case will be printed in a separate line.
```

```
You do not need to print anything. It has already been taken care of. Just implement the given function.
```

```
1 <= T <= 100
1 <= N <= 10 ^ 8
Time Limit: 1 second
```

Popular Interview Problems: