#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main ( ) {
int t;
cin>> t;
while ( t-- ) {
ll n;
cin>> n;
if ( n% 2 == 0 )
cout<< n/ 2 - 1 << endl;
else
cout<< n/ 2 << endl;
}
return 0 ;
}
#include <bits/stdc++.h>
using namespace std;
char s[ 26 ] ;
int main ( ) {
int t;
cin>> t;
while ( t-- ) {
int n, a, b;
cin>> n>> a>> b;
for ( int i = 0 ; i < b; i++ ) {
s[ i] = i + 'a' ;
}
int j = 0 ;
for ( int i = 0 ; i < n; i++ ) {
cout<< s[ j] ;
j = ( j + 1 ) % b;
}
cout<< endl;
}
return 0 ;
}
#include <bits/stdc++.h>
using namespace std;
#define maxn 200001
int main ( ) {
int t;
int n, a[ maxn] , b[ maxn] ;
cin>> t;
while ( t-- ) {
memset ( b, 0 , sizeof ( b) ) ;
cin>> n;
for ( int i= 0 ; i< n; i++ ) {
cin>> a[ i] ;
b[ a[ i] ] ++ ;
}
if ( n== 1 ) {
cout<< 0 << endl;
}
else {
int right = 0 , left= 0 ;
for ( int i= 0 ; i<= n; i++ ) {
if ( b[ i] > 1 && b[ i] > right) {
right = b[ i] ;
}
}
if ( right== 0 ) cout<< 1 << endl;
else {
for ( int i= 0 ; i<= n; i++ ) {
if ( b[ i] >= 1 )
left++ ;
}
if ( right > left) {
cout<< left<< endl;
}
else if ( right == left) {
cout<< left- 1 << endl;
}
else {
cout<< right<< endl;
}
}
}
}
return 0 ;
}
#include <bits/stdc++.h>
using namespace std;
int main ( )
{
int T;
cin>> T;
while ( T-- )
{
char s[ 10 ] [ 10 ] ;
for ( int i= 1 ; i<= 9 ; i++ )
for ( int j= 1 ; j<= 9 ; j++ )
cin>> s[ i] [ j] ;
for ( int i= 1 ; i<= 9 ; i++ )
for ( int j= 1 ; j<= 9 ; j++ )
if ( s[ i] [ j] == '1' )
s[ i] [ j] = '2' ;
for ( int i= 1 ; i<= 9 ; i++ ) {
for ( int j= 1 ; j<= 9 ; j++ )
cout<< s[ i] [ j] ;
cout<< endl;
}
}
return 0 ;
}