// eddy1021
#include <bits/stdc++.h>
using namespace std;
typedef double D;
typedef long long ll;
typedef pair<int,int> PII;
#define mod9 1000000009ll
#define mod7 1000000007ll
#define INF  1023456789ll
#define INF16 10000000000000000ll
#define FI first
#define SE second
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define eps 1e-9
#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(), (x).end()
ll getint(){
  ll _x=0,_tmp=1; char _tc=getchar();
  while( (_tc<'0'||_tc>'9')&&_tc!='-' ) _tc=getchar();
  if( _tc == '-' ) _tc=getchar() , _tmp = -1;
  while(_tc>='0'&&_tc<='9') _x*=10,_x+=(_tc-'0'),_tc=getchar();
  return _x*_tmp;
}
ll mypow( ll _a , ll _x , ll _mod ){
  if( _x == 0 ) return 1ll;
  ll _tmp = mypow( _a , _x / 2 , _mod );
  _tmp = ( _tmp * _tmp ) % _mod;
  if( _x & 1 ) _tmp = ( _tmp * _a ) % _mod;
  return _tmp;
}
bool equal( D _x ,  D _y ){
  return _x > _y - eps && _x < _y + eps;
}
int __ = 1 , cs;
/*********default*********/
#define X 777
#define N 10211021
struct Node{
  Node *nxt[ 2 ], *fail;
  int idx;
}tnode[ N ];
Node *_ptr = tnode, *root;
Node* New(){
  _ptr->nxt[ 0 ] =
  _ptr->nxt[ 1 ] =
  _ptr->fail = NULL;
  _ptr->idx = -1;
  return _ptr ++;
}
void Insert( char s[], int _len, int nidx ){
  Node* ptr = root;
  for( int i = 0 ; i < _len ; i ++ ){
    if( !ptr->nxt[ s[ i ] - 'a' ] )
      ptr->nxt[ s[ i ] - 'a' ] = New();
    ptr=ptr->nxt[ s[ i ] - 'a' ];
  }
  ptr->idx = nidx;
}
queue< Node* > Q;
void buildFailLink(){
  Q.push( root );
  while( Q.size() ){
    Node* ptr = Q.front(); Q.pop();
    for( int i = 0 ; i < 2 ; i ++ ) if( ptr->nxt[ i ] ){
      Node* tmp = ptr->fail;
      while( tmp && !tmp->nxt[ i ] ) tmp = tmp->fail;
      if( tmp ) ptr->nxt[ i ]->fail = tmp->nxt[ i ];
      else ptr->nxt[ i ]->fail = root;
      if( ptr->nxt[ i ]->idx == -1 )
        ptr->nxt[ i ]->idx = ptr->nxt[ i ]->fail->idx;
      Q.push( ptr->nxt[ i ] );
    }
  }
}
int n;
char c[ N ];
int len[ X ], st[ X ];
bool cover[ X ][ X ];
void check( char s[], int _len, int nidx ){
  Node* ptr = root;
  for( int i = 0 ; i < _len ; i ++ ){
    ptr = ptr->nxt[ s[ i ] - 'a' ];
    if( ptr->idx != -1 )
      cover[ nidx ][ ptr->idx ] ++;
    if( ptr->fail && ptr->fail->idx != -1 )
      cover[ nidx ][ ptr->fail->idx ] = true;
  }
}
void build(){

}
void init(){
  root = New();
  n = getint(); int _st = 0;
  for( int i = 0 ; i < n ; i ++ ){
    scanf( "%s" , c + _st );
    st[ i ] = _st;
    len[ i ] = strlen( c + _st );
    Insert( c + _st , len[ i ] , i );
    _st += len[ i ];
  }
  buildFailLink();
  for( int i = 0 ; i < n ; i ++ )
    check( c + st[ i ] , len[ i ] , i );
}
int mx[ X ], my[ X ];
bool vst[ X ];
bool DFS( int now ){
  vst[ now ] = true;
  for( int i = 0 ; i < n ; i ++ )
    if( cover[ now ][ i ] ){
      if( my[ i ] == -1 || ( !vst[ my[ i ] ] && DFS( my[ i ] ) ) ){
        my[ i ] = now;
        mx[ now ] = i;
        return true;
      }
    }
  return false;
}
void matching(){
  for( int i = 0 ; i < n ; i ++ )
    mx[ i ] = my[ i ] = -1;
  for( int i = 0 ; i < n ; i ++ ){
    for( int j = 0 ; j < n ; j ++ ) vst[ j ] = false;
    DFS( i );
  }
}
void test( vector<int>& ans ){
  int _sz = (int)ans.size();
  bool notokay = true;
  while( notokay ){
    notokay = false;
    for( int i = 0 ; i < _sz ; i ++ )
      for( int j = 0 ; j < _sz ; j ++ )
        if( cover[ ans[ i ] ][ ans[ j ] ] ){
          notokay = true;
          ans[ i ] = mx[ ans[ i ] ];
        }
  }
}
void find_ans(){
  vector<int> ans;
  for( int i = 0 ; i < n ; i ++ )
    if( my[ i ] == -1 ) ans.PB( i );
  test( ans );
  printf( "%d\n" , (int)ans.size() );
  for( int i = 0 ; i < (int)ans.size() ; i ++ )
    printf( "%d%c" , ans[ i ] + 1 , " \n"[ i == (int)ans.size() - 1 ] );
}
void solve(){
  vector<PII> vidx;
  for( int i = 0 ; i < n ; i ++ ) vidx.PB( MP( len[ i ] , i ) );
  sort( ALL( vidx ) );
  for( int _ = 0 ; _ < n ; _ ++ ){
    int i = vidx[ _ ].SE;
    for( int j = 0 ; j < n ; j ++ ) if( cover[ i ][ j ] && i != j )
      for( int k = 0 ; k < n ; k ++ )
        cover[ i ][ k ] |= cover[ j ][ k ];
  }
  for( int _ = 0 ; _ < n ; _ ++ ) cover[ _ ][ _ ] = false;
  matching();
  find_ans();
}
int main(){
  build();
  //__ = getint();
  while( __ -- ){
    init();
    solve();
  }
}

// ntuj - dcq44n18liyrdspnr4ax1


#include <iostream>

using namespace std;
int sum;
int main(){
	int n ,a[10000];
	cin >> n;

	for(int i = 0 ;i  <n ; i ++){
		cin >> a[i];
		sum += a[i];
	}
	int pos = 1 ;
	while(pos >= 0 , pos<= n ){
		if(a[pos] < a[pos-1]){
			swap(a[pos] , a[pos-1]);
			pos--;
		}
		else{
			pos++;
		}
	}
	if(n == 2){
		cout << "2";
		return 0;
	}
	int k = 0, ina = 0 , inb = n-1;
	int f = 0 ;
	while(k <= sum/2){
		k += a[ina] + a[inb]; // casdcfasdc
		f++;
		inb --;
		ina ++;
	}
	cout << f;
}


#include <iostream>

using namespace std;
int sum;
int main(){
	int n ,a[10000];
	cin >> n;

	for(int i = 0 ;i  <n ; i ++){
		cin >> a[i];
		sum += a[i];
	}
	if(n == 1){
		cout << "1";
		return 0;
	}
	int pos = 1 ;
	while(pos >= 0 , pos<= n ){
		if(a[pos] < a[pos-1]){
			swap(a[pos] , a[pos-1]);
			pos--;
		}
		else{
			pos++;
		}
	}
	if(n == 2 || n == 3){
		cout << "2";
		return 0; //lf;esjdhofhs
	}
	int k = 0, ina = 0 , inb = n-1;
	int f = 0 ;
	while(k <= sum/2){
		k += a[ina] + a[inb]; // casdcfasdc
		f++;
		inb --;
		ina ++;
	}
	cout << f;
}


#include<iostream>

using namespace std;

int main()
{
	int n,a[100],i,j,sum1=0,sum2=0,count1=0,temp;

	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
		cout<<"\n";
	}
	for(i=0;i<n;i++)
	{
		for(j=i+1;j<n;j++)
		{
			if(a[i] >= a[j])
			{
				temp=a[i];
				a[i]=a[j];
				a[j]=temp;

			}
		}
	}
	for(i=n-1;i>=0;i--)
	{
		sum1+=a[i];
		for(j=0;j<i;j++)
		{

			sum2+=a[j];

			if(sum1>sum2)
			{
				break;
			}
		}

		sum2=0;
		count1++;
	}
	cout<<count1;

	return 0;

}


using namespace std;

int main()
{
	int n,a[100],i,j,sum1=0,sum2=0,count1=0,temp;

	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
		cout<<"\n";
	}
	for(i=0;i<n;i++)
	{
		for(j=i+1;j<n;j++)
		{
			if(a[i] >= a[j])
			{
				temp=a[i];
				a[i]=a[j];
				a[j]=temp;

			}
		}
	}
	for(i=n-1;i>=0;i--)
	{
		count1++;
		sum1+=a[i];
		for(j=0;j<i;j++)
		{

			sum2+=a[j];

		}
			if(sum1>sum2)
			{
				break;
			}

		sum2=0;

	}
	cout<<count1;

	return 0;

}


#include<iostream>

using namespace std;

int main()
{
	int n,a[100],i,j,sum1=0,sum2=0,count1=0,temp;

	cout<<n;
	for(i=0;i<n;i++)
	{
		cout<<a[i]<<"\n";
	}
	for(i=0;i<n;i++)
	{
		for(j=i+1;j<n;j++)
		{
			if(a[i] >= a[j])
			{
				temp=a[i];
				a[i]=a[j];
				a[j]=temp;

			}
		}
	}
	for(i=n-1;i>=0;i--)
	{
		sum1+=a[i];
		for(j=0;j<i;j++)
		{

			sum2+=a[j];
            count1++;

			if(sum1>sum2)
			{
				cout<<count1;
			}
		}

		sum2=0;
	}

	return 0;

}


#include<iostream>

using namespace std;

int main()
{
	int n,a[100],i,j,sum1=0,sum2=0,count1=0,temp;

	cout<<n;
	for(i=0;i<n;i++)
	{
		cout<<a[i]<<"\n";
	}
	for(i=0;i<n;i++)
	{
		for(j=i+1;j<n;j++)
		{
			if(a[i] >= a[j])
			{
				temp=a[i];
				a[i]=a[j];
				a[j]=temp;

			}
		}
	}
	for(i=n-1;i>=0;i--)
	{
		sum1+=a[i];
		for(j=0;j<i;j++)
		{

			sum2+=a[j];
            count1++;

			if(sum1>sum2)
			{
				break;
			}
		}

		sum2=0;
	}

    cout<<count1;
	return 0;

}


#include<iostream>

using namespace std;

int main()
{
	int n,a[100],i,j,sum1=0,sum2=0,count1=0,temp;

	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
		cout<<"\n";
	}
	for(i=0;i<n;i++)
	{
		for(j=i+1;j<n;j++)
		{
			if(a[i] >= a[j])
			{
				temp=a[i];
				a[i]=a[j];
				a[j]=temp;

			}
		}
	}
	for(i=n-1;i>=0;i--)
	{
		count1++;
		sum1+=a[i];
		for(j=0;j<i;j++)
		{

			sum2+=a[j];

		}
			if(sum1>sum2)
			{
				break;
			}

		sum2=0;
		count1++;
	}
	cout<<count1;

	return 0;

}


#include<iostream>

using namespace std;

int main()
{
	int n,a[100],i,j,sum1=0,sum2=0,count1=0,temp;

	cout<<n;
	for(i=0;i<n;i++)
	{
		cout<<a[i]<<"\n";
	}
	for(i=0;i<n;i++)
	{
		for(j=i+1;j<n;j++)
		{
			if(a[i] >= a[j])
			{
				temp=a[i];
				a[i]=a[j];
				a[j]=temp;

			}
		}
	}
	for(i=n-1;i>=0;i--)
	{
		sum1+=a[i];
		for(j=0;j<i;j++)
		{

			sum2+=a[j];

			if(sum1>sum2)
			{
				break;
			}
		}

		sum2=0;
		count1++;
	}
	cout<<count1;

	return 0;

}


#include<iostream>

using namespace std;

int main()
{
	int n,a[100],i,j,sum1=0,sum2=0,count1=0,temp;

	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
		cout<<"\n";
	}
	for(i=0;i<n;i++)
	{
		for(j=i+1;j<n;j++)
		{
			if(a[i] >= a[j])
			{
				temp=a[i];
				a[i]=a[j];
				a[j]=temp;

			}
		}
	}
	for(i=n-1;i>=0;i--)
	{
		sum1+=a[i];
		for(j=0;j<i;j++)
		{

			sum2+=a[j];

		}
			if(sum1>sum2)
			{
				break;
			}

		sum2=0;
		count1++;
	}
	cout<<count1;

	return 0;

}


using namespace std;

int main()
{
	int n,a[100],i,j,sum1=0,sum2=0,count1=0,temp;

	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
		cout<<"\n";
	}
	for(i=0;i<n;i++)
	{
		for(j=i+1;j<n;j++)
		{
			if(a[i] >= a[j])
			{
				temp=a[i];
				a[i]=a[j];
				a[j]=temp;

			}
		}
	}
	for(i=n-1;i>=0;i--)
	{
		sum1+=a[i];
		for(j=0;j<i;j++)
		{

			sum2+=a[j];

		}
			if(sum1>sum2)
			{
				break;
			}

		sum2=0;
		count1++;
	}
	cout<<count1;

	return 0;

}


#include<iostream>

using namespace std;

int main()
{
	int n,a[100],i,j,sum1=0,sum2=0,count1=0,temp;

	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
		cout<<"\n";
	}
	for(i=0;i<n;i++)
	{
		for(j=i+1;j<n;j++)
		{
			if(a[i] >= a[j])
			{
				temp=a[i];
				a[i]=a[j];
				a[j]=temp;

			}
		}
	}
	for(i=n-1;i>=0;i--)
	{
		count1++;
		sum1+=a[i];
		for(j=0;j<i;j++)
		{

			sum2+=a[j];

		}
			if(sum1>sum2)
			{
				break;
			}

		sum2=0;

	}
	cout<<count1;

	return 0;

}


#include<iostream>
using namespace std;
void quickSort(int arr[], int left, int right) {

      int i = left, j = right;

      int tmp;

      int pivot = arr[(left + right) / 2];

      while (i <= j) {

            while (arr[i] < pivot)

                  i++;

            while (arr[j] > pivot)

                  j--;

            if (i <= j) {

                  tmp = arr[i];

                  arr[i] = arr[j];

                  arr[j] = tmp;

                  i++;

                  j--;

            }

      };

      if (left < j)

            quickSort(arr, left, j);

      if (i < right)

            quickSort(arr, i, right);

}
int main()
{
    int c=0,sum=0,taken=0,n;
    cin >> n;
    int a[n];
    for(int i=0;i<n;i++)
    {
     cin >> a[n];
     sum+=a[i];
    }
    quickSort(a,0,n);
    for(int i=n-1;taken>sum;i++)
    {
        taken+=a[i];
        c++;
        sum-=a[i];
    }
    cout << c << endl;
}


#include<iostream>
using namespace std;
void quickSort(int arr[], int left, int right) {

      int i = left, j = right;
      int tmp;
      int pivot = arr[(left + right) / 2];
      while (i <= j) {
            while (arr[i] < pivot)
                  i++;
            while (arr[j] > pivot)
                  j--;
            if (i <= j) {
                  tmp = arr[i];
                  arr[i] = arr[j];
                  arr[j] = tmp;
                  i++;
                  j--;
            }
      };
      if (left < j)
            quickSort(arr, left, j);
      if (i < right)
            quickSort(arr, i, right);
}
int main()
{
    int c=0,sum=0,taken=0,n;
    cin >> n;
    int a[n];
    for(int i=0;i<n;i++)
    {
     cin >> a[n];
     sum+=a[i];
    }
    quickSort(a,0,n-1);
    for(int i=n-1;(i>=0&&sum>=taken);i--)
    {
        taken+=a[i];
        c++;
        sum-=a[i];
    }
    cout << c << endl;
}


#include<iostream>
using namespace std;
void quickSort(int arr[], int left, int right) {

      int i = left, j = right;

      int tmp;

      int pivot = arr[(left + right) / 2];

      while (i <= j) {

            while (arr[i] < pivot)

                  i++;

            while (arr[j] > pivot)

                  j--;

            if (i <= j) {

                  tmp = arr[i];

                  arr[i] = arr[j];

                  arr[j] = tmp;

                  i++;

                  j--;

            }

      };

      if (left < j)

            quickSort(arr, left, j);

      if (i < right)

            quickSort(arr, i, right);

}
int main()
{
    int c=0,sum=0,taken=0,n;
    cin >> n;
    int a[n];
    for(int i=0;i<n;i++)
    {
     cin >> a[n];
     sum+=a[i];
    }
    quickSort(a,0,n);
    for(int i=n-1;taken>sum;i--)
    {
        taken+=a[i];
        c++;
        sum-=a[i];
    }
    cout << c << endl;
}


#include<iostream>
using namespace std;
void quickSort(int arr[], int left, int right) {

      int i = left, j = right;

      int tmp;

      int pivot = arr[(left + right) / 2];

      while (i <= j) {

            while (arr[i] < pivot)

                  i++;

            while (arr[j] > pivot)

                  j--;

            if (i <= j) {

                  tmp = arr[i];

                  arr[i] = arr[j];

                  arr[j] = tmp;

                  i++;

                  j--;

            }

      };

      if (left < j)

            quickSort(arr, left, j);

      if (i < right)

            quickSort(arr, i, right);

}
int main()
{
    int c=0,sum=0,taken=0,n;
    cin >> n;
    int a[n];
    for(int i=0;i<n;i++)
    {
     cin >> a[n];
     sum+=a[i];
    }
    quickSort(a,0,n);
    for(int i=n-1;taken=<sum;i--)
    {
        taken+=a[i];
        c++;
        sum-=a[i];
    }
    cout << c << endl;
}


#include<iostream>
#include <algorithm>
using namespace std;
int main()
{
    int n,sum=0,left=0,taken=0,c=0;
    cin >> n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin >> a[i];
        sum+=a[i];
    }
    sort(a,a+n);
    for(int i=n-1;left>=taken;i--)
    {
        taken+=a[i];
        left=sum-taken;
    }
    cout << c << endl;
}


#include<iostream>
using namespace std;
void quickSort(int arr[], int left, int right) {

      int i = left, j = right;
      int tmp;
      int pivot = arr[(left + right) / 2];
      while (i <= j) {
            while (arr[i] < pivot)
                  i++;
            while (arr[j] > pivot)
                  j--;
            if (i <= j) {
                  tmp = arr[i];
                  arr[i] = arr[j];
                  arr[j] = tmp;
                  i++;
                  j--;
            }

      };

      if (left < j)

            quickSort(arr, left, j);

      if (i < right)

            quickSort(arr, i, right);

}
int main()
{
    int c=0,sum=0,taken=0,n;
    cin >> n;
    int a[n];
    for(int i=0;i<n;i++)
    {
     cin >> a[n];
     sum+=a[i];
    }
    quickSort(a,0,n-1);
    int i=n-1;
    while(sum>=taken&&i>=0)
    {
        taken+=a[i];
        c++;
        sum-=a[i];
        i--;
    }
    cout << c << endl;
}


#include<iostream>
#include <algorithm>
using namespace std;
int main()
{
    int n,sum=0,left=0,taken=0,c=0;
    cin >> n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin >> a[i];
        sum+=a[i];
    }
    sort(a,a+n);
    for(int i=n-1;left>=taken;i--)
    {
        taken+=a[i];
        left=sum-taken;
        c++;
    }
    cout << c << endl;
}


#include<iostream>
using namespace std;
void quickSort(int arr[], int left, int right) {

      int i = left, j = right;

      int tmp;

      int pivot = arr[(left + right) / 2];

      while (i <= j) {

            while (arr[i] < pivot)

                  i++;

            while (arr[j] > pivot)

                  j--;

            if (i <= j) {

                  tmp = arr[i];

                  arr[i] = arr[j];

                  arr[j] = tmp;

                  i++;

                  j--;

            }

      };

      if (left < j)

            quickSort(arr, left, j);

      if (i < right)

            quickSort(arr, i, right);

}
int main()
{
    int c=0,sum=0,taken=0,n;
    cin >> n;
    int a[n];
    for(int i=0;i<n;i++)
    {
     cin >> a[n];
     sum+=a[i];
    }
    quickSort(a,0,n);
    int i=n-1;
    while(sum>taken)
    {
        taken+=a[i];
        c++;
        sum-=a[i];
        i--;
    }
    cout << c << endl;
}


#include<iostream>
using namespace std;
void quickSort(int arr[], int left, int right) {

      int i = left, j = right;

      int tmp;

      int pivot = arr[(left + right) / 2];

      while (i <= j) {

            while (arr[i] < pivot)

                  i++;

            while (arr[j] > pivot)

                  j--;

            if (i <= j) {

                  tmp = arr[i];

                  arr[i] = arr[j];

                  arr[j] = tmp;

                  i++;

                  j--;

            }

      };

      if (left < j)

            quickSort(arr, left, j);

      if (i < right)

            quickSort(arr, i, right);

}
int main()
{
    int c=0,sum=0,taken=0,n;
    cin >> n;
    int a[n];
    for(int i=0;i<n;i++)
    {
     cin >> a[n];
     sum+=a[i];
    }
    quicksort(a,0,n);
    for(int i=n-1;taken>sum;i++)
    {
        taken+=a[i];
        c++;
        sum-=a[i];
    }
    cout << c << endl;
}


#include<bits/stdc++.h>
using namespace std;
int main(){

    int n;
    cin >> n;
    int a[n+1], tong=0, c=0;
    for(int i=1; i<=n; i++)
    {
        cin >> a[i];
        tong+=a[i];
    }
    sort(a+1, a+n+1);
    for(int i=n; i>=1; i++)
    {
        c+=a[i];
        tong-=a[i];
        if(c>tong)
        {
            cout << i;
            return 0;
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
int main(){

    int n;
    cin >> n;
    int a[n+1], tong=0, c=0;
    for(int i=1; i<=n; i++)
    {
        cin >> a[i];
        tong+=a[i];
    }
    for(int i=1; i<=n; i++)
    {
        c+=a[i];
        if(c>tong/2)
        {
            cout << i;
            return 0;
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
int maini{

    int n;
    cin >> n;
    int a[n+1], tong=0, c=0;
    for(int i=1; i<=n; i++)
    {
        cin >> a[i];
        tong+=a[i];
    }
    for(int i=1; i<=n; i++)
    {
        c+=a[i];
        if(c>tong/2)
        {
            cout << i;
            return 0;
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
int main(){

    int n;
    cin >> n;
    int a[n+1], tong=0, c=0;
    for(int i=1; i<=n; i++)
    {
        cin >> a[i];
        tong+=a[i];
    }
    for(int i=1; i<=n; i++)
    {
        c+=a[i];
        tong-=a[i];
        if(c>tong)
        {
            cout << i;
            return 0;
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
int main(){

    int n;
    cin >> n;
    int a[1000], tong=0, c=0;
    for(int i=1; i<=n; i++)
    {
        cin >> a[i];
        tong+=a[i];
    }
    sort(a+1, a+n+1);
    for(int i=n; i>=1; i++)
    {
        c+=a[i];
        tong-=a[i];
        if(c>tong)
        {
            cout << n-1+1;
            return 0;
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
int main(){

    int n;
    cin >> n;
    int a[1000], tong=0, c=0;
    for(int i=1; i<=n; i++)
    {
        cin >> a[i];
        tong+=a[i];
    }
    sort(a+1, a+n+1);
    for(int i=n; i>=1; i--)
    {
        c+=a[i];
        tong-=a[i];
        if(c>tong)
        {
            cout << n-i+1;
            return 0;
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
int maini(){

    int n;
    cin >> n;
    int a[n+1], tong=0, c=0;
    for(int i=1; i<=n; i++)
    {
        cin >> a[i];
        tong+=a[i];
    }
    for(int i=1; i<=n; i++)
    {
        c+=a[i];
        if(c>tong/2)
        {
            cout << i;
            return 0;
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
int main(){

    int n;
    cin >> n;
    int a[n+1], tong=0, c=0;
    for(int i=1; i<=n; i++)
    {
        cin >> a[i];
        tong+=a[i];
    }
    for(int i=1; i<=n; i++)
    {
        c+=a[i];
        tong-=a[i]
        if(c>tong)
        {
            cout << i;
            return 0;
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
int main(){

    int n;
    cin >> n;
    int a[n+1], tong=0, c=0;
    for(int i=1; i<=n; i++)
    {
        cin >> a[i];
        tong+=a[i];
    }
    sort(a+1, a+n+1, greater<int>);
    for(int i=1; i<=n; i++)
    {
        c+=a[i];
        tong-=a[i];
        if(c>tong)
        {
            cout << i;
            return 0;
        }
    }
}


        #include <iostream>
        #include <bits/stdc++.h>
        //#include <map>

        using namespace std;
        int main()
        {
            ios::sync_with_stdio(0);
            cin.tie(0),cout.tie(0) ;

    int test,coint,max1=0,max2=0,z=0,arr[10000];

cin>>test;
if(test%2==0){z=test/2;}
else z=(test/2)+1;
 for(int i=1;i<=test;i++)
 {
     cin>>coint;
     arr[i]=coint;
 }
 if(test==2&&arr[1]==arr[2])cout<<2<<endl;
else if(test==0) cout<<0<<endl;
 else
cout<<z<<endl;

return 0;
        }


    #include <iostream>
    #include <bits/stdc++.h>
    //#include <map>

    using namespace std;
    int main()
    {
        ios::sync_with_stdio(0);
        cin.tie(0),cout.tie(0) ;

int test,coint,max1=0,max2=0,ans=0,arr[10000];
cin>>test;
for(int i=1;i<=test;i++)
{
cin>>coint;
arr[i]=coint ;

}
sort(arr,arr+test);
for(int i=1,j=test;i<=test,j>0;i++,j--)
{
    ans++;
    max1+=arr[i];
    max2=arr[test];
if(max2<max1){test--;}
if(max1>max2){break;}
}
cout<<ans<<endl;

            return 0;
        }


        #include <iostream>
        #include <bits/stdc++.h>
        //#include <map>

        using namespace std;
        int main()
        {
            ios::sync_with_stdio(0);
            cin.tie(0),cout.tie(0) ;

    int test,coint,max1=0,max2=0,z=0,arr[10000];

cin>>test;
if(test%2==0){z=test/2;}
else z=(test/2)+1;
 for(int i=1;i<=test;i++)
 {
     cin>>coint;
     arr[i]=coint;
 }
 if(test==2&&arr[1]==arr[2])cout<<2<<endl;
 if(test==0) cout<<0<<endl;
 else
cout<<z<<endl;

return 0;
        }


    #include <iostream>
    #include <bits/stdc++.h>
    //#include <map>

    using namespace std;
    int main()
    {
        ios::sync_with_stdio(0);
        cin.tie(0),cout.tie(0) ;
int x,z;
int mx=0,v=0;
cin>>x;
for(int i=1;i<=x;i++)
{
    cin>>z;
    if(mx<=z){mx=mx+z;v++;}
}
cout<<v<<endl;

            return 0;
        }


#include <bits/stdc++.h>
#include <string.h>
#include <stdio.h>
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define fio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);

using namespace std;

int main()
{
    fio

    int n ;
    cin >> n ;
    int arr[n];
    int sum = 0;
    for (int i = 0 ; i < n ; i++)
    {
        cin >> arr[i];
        sum +=arr[i];
    }

    sort(arr , arr+n);
    int me = arr[n-1];
    int counter = 1;
    sum = sum -me ;
    int index = n-2;
   // cout <<index;
    //cout << me << sum ;
    while (me <= sum && index >=0)
    {
        counter++;
        me += arr[index];
        sum -= arr[index];
        index--;
    }

    cout << counter;

    return 0;
}


        #include <iostream>
        #include <bits/stdc++.h>
        //#include <map>

        using namespace std;
        int main()
        {
            ios::sync_with_stdio(0);
            cin.tie(0),cout.tie(0) ;

    int test,coint,max1=0,max2=0,z=0,arr[10000];

cin>>test;
if(test%2==0){z=test/2;}
else z=(test/2)+1;
 for(int i=1;i<=test;i++)
 {
     cin>>coint;
     arr[i]=coint;
 }
 if(test==2&&arr[1]==arr[2])cout<<2<<endl;
 else
cout<<z<<endl;

return 0;
        }


    #include <iostream>
    #include <bits/stdc++.h>
    //#include <map>

    using namespace std;
    int main()
    {
        ios::sync_with_stdio(0);
        cin.tie(0),cout.tie(0) ;
int x,z,cc=0,h=0,sum=0;
int arr[100];
cin>>x;
for(int i=1;i<=x;i++)
{

    cin>>z;
    arr[i]=z;
}
            sort(arr,arr+x);

for(int i=1;i<=x;i++)
        {
            sum+=arr[i];
        }
        sum=sum/2;
for(int i=x;i>=1;i--)
{
cc++;
    h+=arr[i];
    if(h>sum){break;}
}
cout<<cc<<endl;
            return 0;
        }


        #include <iostream>
        #include <bits/stdc++.h>
        //#include <map>

        using namespace std;
        int main()
        {
            ios::sync_with_stdio(0);
            cin.tie(0),cout.tie(0) ;

    int cc=1,test,coint,max1=0,max2=0,z=0,arr[10000];
cin>>test;
 for(int i=0;i<test;i++)
 {
     cin>>coint;
     arr[i]=coint;
     max1+=arr[i];
 }

 sort(arr,arr+test);
  max2=arr[test-1];
 int sum=0;max1=max1-max2;

 for(int i=test-2;max1>=max2;test--)
 {
     cc++;
     max2+=arr[i];
     max1-=arr[i];
}

cout<<cc<<endl;

return 0;
    }


        #include <iostream>
        #include <bits/stdc++.h>
        //#include <map>

        using namespace std;
        int main()
        {
            ios::sync_with_stdio(0);
            cin.tie(0),cout.tie(0) ;

    int cc=0,test,coint,max1=0,max2=0,z=0,arr[10000];

cin>>test;
if(test%2==0){z=test/2;}
else z=(test/2)+1;
 for(int i=1;i<=test;i++)
 {
     cin>>coint;
     arr[i]=coint;
     max1+=arr[i];
 }

 sort(arr,arr+test);

 for(int i=z;max2<=max1;i--)
 {
     cc++;
     max2+=arr[z];
}

cout<<cc-1<<endl;

return 0;
    }


        #include <iostream>
        #include <bits/stdc++.h>
        //#include <map>

        using namespace std;
        int main()
        {
            ios::sync_with_stdio(0);
            cin.tie(0),cout.tie(0) ;

    int cc=0,test,coint,max1=0,max2=0,z=0,arr[10000];
cin>>test;
if(test%2==0){z=test/2;}
else z=(test/2)+1;
 for(int i=1;i<=test;i++)
 {
     cin>>coint;
     arr[i]=coint;
     max1+=arr[i];
 }

 sort(arr,arr+test);

 for(int i=test;max2<=max1;test--)
 {
     cc++;
     max2+=arr[z];
}

cout<<cc-1<<endl;

return 0;
    }


        #include <iostream>
        #include <bits/stdc++.h>
        //#include <map>

        using namespace std;
        int main()
        {
            ios::sync_with_stdio(0);
            cin.tie(0),cout.tie(0) ;

    int cc=1,test,coint,max1=0,max2=0,z=0,arr[10000];
cin>>test;
 for(int i=0;i<test;i++)
 {
     cin>>coint;
     arr[i]=coint;
     max1+=arr[i];
 }

 sort(arr,arr+test);
  max2=arr[test-1];
 max1=max1-max2;

 for(int i=test-2;max2<=max1&&test>=0;test--)
 {
     cc++;
     max2+=arr[i];
     max1-=arr[i];
}

cout<<cc<<endl;

return 0;
    }


#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

int func(int *arr,int s){
int als=0;
for (int i=0;i<s;i++){
    arr[i]+=arr[i+1];
    ++als;

}
if ((als%2)==0)
    return als/2;
else{
    als--;
    als/=2;
    als++;
    return als;}
}

 int main()
{
int num,coins=0,sum=0;
cin>>num;
int val[num];

for(int i=0;i<num;i++)
{
    cin>>val[i];
    sum+=val[i];
}

sort(val, val+num, std::greater<int>());

for (int i=0;i<num;i++)
{
    if(val[i]>(sum-val[i])){
        cout<<++coins;
        return 0;
                         }
    if(val[i]==(sum-val[i])){
        if (num==2)
            cout<<2;
        else
        cout<<num-1;
        return 0;
                         }

}

int aals=func(val,num);
coins+=2;
while (true)
{

for (int i=0;i<aals;i++)
{
    if(val[i]>(sum-val[i])){
        cout<<coins;
        return 0;
                         }
}

aals=func(val,aals);
if (num%2==0)
coins+=coins;
else
    coins++;
}
}


#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

int func(int *arr,int s){
int als=0;
for (int i=0;i<s;i++){
    arr[i]+=arr[i+1];
    ++als;

}
if ((als%2)==0)
    return als/2;
else{
    als--;
    als/=2;
    als++;
    return als;}
}

 int main()
{
int num,coins=0,sum=0;
cin>>num;
int val[num];

for(int i=0;i<num;i++)
{
    cin>>val[i];
    sum+=val[i];
}

sort(val, val+num, std::greater<int>());

for (int i=0;i<num;i++)
{
    if(val[i]>(sum-val[i])){
        cout<<++coins;
        return 0;
                         }
    if(val[i]==(sum-val[i])){
        if (num==2)
            cout<<2;
        else
        cout<<num-1;
        return 0;
                         }

}

int aals=func(val,num);
coins+=2;
while (true)
{

for (int i=0;i<aals;i++)
{
    if(val[i]>(sum-val[i])){
        cout<<coins;
        return 0;
                         }
}
aals=func(val,aals);
coins++;
}
main();
}


#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

int func(int *arr,int s){
int als=0;
for (int i=0;i<s;i++){
    arr[i]+=arr[i+1];
    ++als;

}
if ((als%2)==0)
    return als/2;
else{
    als--;
    als/=2;
    als++;
    return als;}
}

 int main()
{
int num,coins=0,sum=0;
cin>>num;
int val[num];

for(int i=0;i<num;i++)
{
    cin>>val[i];
    sum+=val[i];
}

sort(val, val+num, std::greater<int>());

for (int i=0;i<num;i++)
{
    if(val[i]>(sum-val[i])){
        cout<<++coins;
        return 0;
                         }
    if(val[i]==(sum-val[i])){
        if (num==2)
            cout<<2;
        else
        cout<<num-1;
        return 0;
                         }

}

int aals=func(val,num);
coins+=2;
while (true)
{

for (int i=0;i<aals;i++)
{
    if(val[i]>(sum-val[i])){
        cout<<coins;
        return 0;
                         }
    if(val[i]==(sum-val[i])){
        cout<<aals;
        return 0;
                         }
}
aals=func(val,aals);
coins+=2;
}

}


#include <iostream>
#include <cmath>
using namespace std;
 int main()
{
int num,val,sum=0;
cin>>num;

for(int i=0;i<num;i++)
{
    cin>>val;
    sum+=val;
}
if (sum%2==0)
    cout<<num;
else
    cout<<ceil(sum/2);
return 0;
}


#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

int func(int *arr,int s){
int als=0;
for (int i=0;i<s;i++){
    arr[i]+=arr[i+1];
    ++als;

}
if ((als%2)==0)
    return als/2;
else{
    als--;
    als/=2;
    als++;
    return als;}
}

 int main()
{
int num,coins=0,sum=0;
cin>>num;
int val[num];

for(int i=0;i<num;i++)
{
    cin>>val[i];
    sum+=val[i];
}

sort(val, val+num, std::greater<int>());

for (int i=0;i<num;i++)
{
    if(val[i]>(sum-val[i])){
        cout<<++coins;
        return 0;
                         }
    if(val[i]==(sum-val[i])){
        if (num==2)
            cout<<2;
        else
        cout<<num-1;
        return 0;
                         }

}

int aals=func(val,num);
coins+=2;
while (true)
{

for (int i=0;i<aals;i++)
{
    if(val[i]>(sum-val[i])){
        cout<<coins;
        return 0;
                         }
}
aals=func(val,aals);
if (num%2==0)
coins+=2;
else
    coins++;
}

}


#include <iostream>
#include <cmath>
using namespace std;
 int main()
{
int num,val,sum=0;
cin>>num;

for(int i=0;i<num;i++)
{
    cin>>val;
    sum+=val;
}

if (num==1)
    cout<<num;

else if (sum%2==0)
    cout<<num;

else
    cout<<ceil(sum/2);
return 0;
}


#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

int func(int *arr){
    arr[0]+=arr[1];
    arr[1]=0;
}

 int main()
{
int num,coins=0,sum=0;
cin>>num;
int val[num];

for(int i=0;i<num;i++)
{
    cin>>val[i];
    sum+=val[i];
}

sort(val, val+num, std::greater<int>());

for (int i=0;i<num;i++)
{
    if(val[i]>(sum-val[i])){
        cout<<++coins;
        return 0;
                         }
    if(val[i]==(sum-val[i])){
        if (num==2)
            cout<<2;
        else
        cout<<num-1;
        return 0;
                         }

}

func(val);
coins+=2;
while (true)
{

if(val[0]>(sum-val[0])){
        cout<<coins;
        return 0;
                         }

sort(val, val+num, std::greater<int>());
func(val);
coins++;
}
}


#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

int func(int *arr){
    arr[0]+=arr[1];
    arr[1]=0;
}

 int main()
{
int num,coins=0,sum=0;
cin>>num;
int val[num];

for(int i=0;i<num;i++)
{
    cin>>val[i];
    sum+=val[i];
}

sort(val, val+num, std::greater<int>());

for (int i=0;i<num;i++)
{
    if(val[i]>(sum-val[i])){
        cout<<++coins;
        return 0;
                         }
    if(val[i]==(sum-val[i])){
        if (num==2)
            cout<<2;
        else
        cout<<num-1;
        return 0;
                         }

}

func(val);
coins++;
while (true)
{

if(val[0]>(sum-val[0])){
        cout<<coins;
        return 0;
                         }

func(val);
sort(val, val+num, std::greater<int>());
coins++;
}
}


#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

int func(int *arr,int s){
int als=0;
for (int i=0;i<s;i++){
    arr[i]+=arr[i+1];
    ++als;

}
if ((als%2)==0)
    return als/2;
else{
    als--;
    als/=2;
    als++;
    return als;}
}

 int main()
{
int num,coins=0,sum=0;
cin>>num;
int val[num];

for(int i=0;i<num;i++)
{
    cin>>val[i];
    sum+=val[i];
}

sort(val, val+num, std::greater<int>());

for (int i=0;i<num;i++)
{
    if(val[i]>(sum-val[i])){
        cout<<++coins;
        return 0;
                         }
    if(val[i]==(sum-val[i])){
        cout<<num-1;
        return 0;
                         }

}

int aals=func(val,num);
coins+=2;
while (true)
{

for (int i=0;i<aals;i++)
{
    if(val[i]>(sum-val[i])){
        cout<<coins;
        return 0;
                         }
    if(val[i]==(sum-val[i])){
        cout<<aals;
        return 0;
                         }
}
aals=func(val,aals);
coins+=2;
}

}


#include <iostream>
using namespace std;
 int main()
{
int num,coins=0,sum=0,sum1=0,x=1;
cin>>num;
int val[num];

for(int i=0;i<num;i++)
    cin>>val[i];

if (num==1)
{
    cout<<1;
    return 0;
}

if (num==2)
{
    if (val[0]>val[1]||val[1]<val[0]){
    cout<<1;
    return 0;}

    else
    {
        cout<<2;
        return 0;
    }
}

for(int i=0;i<num;i++)
{
    if ((num-x)>=i)
    {
        sum+=val[i];
            coins++;
    }

    if ((num-x)>i)
    {
         sum1+=val[num-x];
            x++;
    }

}

cout<<coins;

return 0;
}


#include <bits/stdc++.h>
#include <cmath>
typedef long long int ll;
using namespace std;
int main()
{
	int n,arr[n];cin>>n;
	double sum = 0;int i=0;
	while(i<n){
		int a;cin>>a;
		arr[i] = a;
		sum = sum+a;
		i++;
	}
	sort(arr, arr + n);
	bool flag = false;int j=0;
	double sum1 = 0;
	while(flag = false){
		sum1 = sum1+arr[j];
		if(sum1>sum/2){
			flag = true;
		}
		j++;
	}
	cout<<j<<endl;

}


#include <bits/stdc++.h>
#include <cmath>
typedef long long int ll;
using namespace std;
int main()
{
	int n,arr[n];cin>>n;
	int j=0;
	double sum = 0;int i=0;
	while(i<n){
		int a;cin>>a;
		arr[i] = a;
		sum = sum+a;
		i++;
	}
	sort(arr, arr + n);
	double sum1 = 0;int count = 0;
	while(j<n){
		sum1 = sum1+arr[j];
		if(sum1>sum/2){
			j=n;
			count=count;
		}
		else{
			j++;count++;
		}

	}
	cout<<count<<endl;

}


#include <bits/stdc++.h>
#include <cmath>
typedef long long int ll;
using namespace std;
int main()
{
	int n;cin>>n;
	int arr[n]
	double sum = 0;int i=0;
	while(i<n){
		int a;cin>>a;
		arr[i] = a;
		sum = sum+a;
		i++;
	}
	sort(arr, arr + n);
	double sum1=0;int j=0;
	while(sum1<=sum/2){
		sum1 = sum1 + arr[n-j-1];
		j++;
	}
	cout<<j<<endl;

}


#include <bits/stdc++.h>
#include <cmath>
typedef long long int ll;
using namespace std;
int main()
{
	int n,arr[n];cin>>n;
	int j=0;
	double sum = 0;int i=0;
	while(i<n){
		int a;cin>>a;
		arr[i] = a;
		sum = sum+a;
		i++;
	}
	sort(arr, arr + n);
	double sum1 = 0;int count = 0;
	while(j<n){
		sum1 = sum1+arr[j];
		if(sum1>=sum/2){
			j=n;
			count++;
		}
		else{
			j++;count++;
		}

	}
	cout<<count<<endl;

}


#include <bits/stdc++.h>
#include <cmath>
typedef long long int ll;
using namespace std;
int main()
{
	int n,arr[n];cin>>n;
	int j=0;
	double sum = 0;int i=0;
	while(i<n){
		int a;cin>>a;
		arr[i] = a;
		sum = sum+a;
		i++;
	}
	sort(arr, arr + n);
	double sum1=0;
	while(sum1<=sum/2){
		sum1 = sum1 + arr[n-j-1];
		j++;
	}
	cout<<j<<endl;

}


#include <bits/stdc++.h>
#include <cmath>
typedef long long int ll;
using namespace std;
int main()
{
	int n,arr[n];cin>>n;
	double sum = 0;int i=0;
	while(i<n){
		int a;cin>>a;
		arr[i] = a;
		sum = sum+a;
		i++;
	}
	sort(arr, arr + n);
	bool flag = false;int j=0;
	double sum1 = 0;
	while(flag = false){
		sum1 = sum1+arr[j];
		if(sum1>sum/2){
			flag = true;
			j++;
		}
		else{
			flag = false;
			j++;
		}

	}
	cout<<n-j<<endl;

}


#include <bits/stdc++.h>
#include <cmath>
typedef long long int ll;
using namespace std;
int main()
{
	int n;cin>>n;
	int arr[n];
	double sum = 0;int i=0;
	while(i<n){
		int a;cin>>a;
		arr[i] = a;
		sum = sum+a;
		i++;
	}
	sort(arr, arr + n);
	double sum1=0;int j=0;
	while(sum1<=sum/2){
		sum1 = sum1 + arr[n-j-1];
		j++;
	}
	cout<<j<<endl;

}


#include <bits/stdc++.h>
#include <cmath>
typedef long long int ll;
using namespace std;
int main()
{
	int n,arr[n];cin>>n;
	double sum = 0;int i=0;
	while(i<n){
		int a;cin>>a;
		arr[i] = a;
		sum = sum+a;
		i++;
	}
	sort(arr, arr + n);
	bool flag = false;int j=0;
	double sum1 = 0;
	while(flag = false){
		sum1 = sum1+arr[j];
		if(sum1>sum/2){
			flag = true;
			j++;
		}
		else{
			flag = false;
			j++;
		}

	}
	cout<<j<<endl;

}


#include <bits/stdc++.h>
#include <cmath>
typedef long long int ll;
using namespace std;
int main()
{
	int n,arr[n];cin>>n;
	double sum = 0;int i=0;
	while(i<n){
		int a;cin>>a;
		arr[i] = a;
		sum = sum+a;
		i++;
	}
	sort(arr, arr + n);
	double sum1=0;int j=0;
	while(sum1<=sum/2){
		sum1 = sum1 + arr[n-j-1];
		j++;
	}
	cout<<j<<endl;

}


#include <bits/stdc++.h>
#include <cmath>
typedef long long int ll;
using namespace std;
int main()
{
	int n,arr[n];cin>>n;
	int j=0;
	double sum = 0;int i=0;
	while(i<n){
		int a;cin>>a;
		arr[i] = a;
		sum = sum+a;
		i++;
	}
	sort(arr, arr + n);
	double sum1 = 0;int count = 0;
	while(j<n){
		sum1 = sum1+arr[j];
		if(sum1>sum/2){
			j=n;
		}
		else{
			j++;
		}
		count++;

	}
	cout<<count<<endl;

}


#include <bits/stdc++.h>
#include <cmath>
typedef long long int ll;
using namespace std;
int main()
{
	int n,arr[n];cin>>n;
	int j=0;
	double sum = 0;int i=0;
	while(i<n){
		int a;cin>>a;
		arr[i] = a;
		sum = sum+a;
		i++;
	}
	sort(arr, arr + n);
	double sum1=0;int count = 0;
	while(sum1<=sum/2){
		sum1 = sum1 + arr[n-j-1];
		count++;j++;
	}
	cout<<count<<endl;

}


#include <bits/stdc++.h>
#include <cmath>
typedef long long int ll;
using namespace std;
int main()
{
	int n,arr[n];cin>>n;
	double sum = 0;int i=0;
	while(i<n){
		int a;cin>>a;
		arr[i] = a;
		sum = sum+a;
		i++;
	}
	sort(arr, arr + n);
	bool flag = false;int j=0;
	double sum1 = 0;
	while(flag = false){
		sum1 = sum1+arr[j];
		if(sum1>sum/2){
			flag = true;
			j++;
		}
		else{
			flag = false;
			j++;
		}

	}
	cout<<sum<<endl;

}


#include <iostream>
#include <algorithm>
#include <vector>
#include<bits/stdc++.h>

using namespace std;
#define soads_game int main()

soads_game
{
    int n;
    cin >> n;

    vector<int> a(n);
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
    }
    int value = accumulate(a.begin(), a.end(), 0) / 2;
    sort(a.begin(), a.end(),greater<int>());
    //cout<<a[0]<<a[1]<<a[2]<<endl;
    int mine = 0;
    size_t i = 0;
    while (mine <= value)
    {
        mine += a[i++];

    }

    cout << i << endl;
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include<bits/stdc++.h>

using namespace std;
#define soads_game int main()

soads_game
{
    int n;
    cin >> n;

    vector<int> a(n);
    for (int i = 0; i < =n; ++i)
    {
        cin >> a[i];
    }
    int value = accumulate(a.begin(), a.end(), 0) / 2;
    sort(a.begin(), a.end());
    //cout<<a[0]<<a[1]<<a[2]<<endl;
    int mine = 0;
    size_t i = 0;
    while (mine < value)
    {
        mine += a[i++];

    }

    cout << i << endl;
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include<bits/stdc++.h>

using namespace std;
#define soads_game int main()

soads_game
{
    int n;
    cin >> n;

    vector<int> a(n);
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
    }
    int value = accumulate(a.begin(), a.end(), 0) / 2;
    sort(a.begin(), a.end());
    //cout<<a[0]<<a[1]<<a[2]<<endl;
    int mine = 0;
    size_t i = 0;
    while (mine <= value)
    {
        mine = a[i++];

    }

    cout << i << endl;
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include<bits/stdc++.h>

using namespace std;
#define soads_game int main()

soads_game
{
    int n;
    cin >> n;

    vector<int> a(n);
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
    }
    int value = accumulate(a.begin(), a.end(), 0) / 2;
    sort(a.begin(), a.end());
    //cout<<a[0]<<a[1]<<a[2]<<endl;
    int mine;
    size_t i = 0;
    while (mine <= value)
    {
        mine += a[i++];

    }

    cout << i << endl;
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include<bits/stdc++.h>

using namespace std;
#define soads_game int main()

soads_game
{
    int n;
    cin >> n;

    vector<int> a(n);
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
    }
    //int value = accumulate(a.begin(), a.end(), 0) / 2;
    sort(a.begin(), a.end());
    //cout<<a[0]<<a[1]<<a[2]<<endl;
    int mine = 0;
    size_t i = 0;
    while (mine <= value)
    {
        mine += a[i++];

    }

    cout << i << endl;
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include<bits/stdc++.h>

using namespace std;
#define soads_game int main()

soads_game
{
    int n;
    cin >> n;

    vector<int> a(n);
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
    }
    int value = accumulate(a.begin(), a.end(), 0);
    sort(a.begin(), a.end());
    //cout<<a[0]<<a[1]<<a[2]<<endl;
    int mine = 0;
    size_t i = 0;
    while (mine <= value)
    {
        mine += a[i++];

    }

    cout << i << endl;
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include<bits/stdc++.h>

using namespace std;
#define soads_game int main()

soads_game
{
    int n;
    cin >> n;

    vector<int> a(n);
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
    }
    int value = accumulate(a.begin(), a.end(), 0) / 2;
    //sort(a.begin(), a.end());
    //cout<<a[0]<<a[1]<<a[2]<<endl;
    int mine = 0;
    size_t i = 0;
    while (mine <= value)
    {
        mine += a[i++];

    }

    cout << i << endl;
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include<bits/stdc++.h>

using namespace std;
#define soads_game int main()

soads_game
{
    int n;
    cin >> n;

    vector<int> a(n);
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
    }
    int value = accumulate(a.begin(), a.end(), 0) / 2;
    sort(a.begin(), a.end());
    //cout<<a[0]<<a[1]<<a[2]<<endl;
    int mine = 0;
    size_t i = 0;
    while (mine <= value)
    {
        mine += a[i++];

    }

    cout << i << endl;
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include<bits/stdc++.h>

using namespace std;
#define soads_game int main()

soads_game
{
    int n;
    cin >> n;

    vector<int> a(n);
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
    }
    int value = accumulate(a.begin(), a.end(), 0) / 2;
    sort(a.begin(), a.end());
    //cout<<a[0]<<a[1]<<a[2]<<endl;
    int mine = 0;
    size_t i = 0;
    while (mine >= value)
    {
        mine += a[i++];

    }

    cout << i << endl;
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include<bits/stdc++.h>

using namespace std;
#define soads_game int main()

soads_game
{
    int n;
    cin >> n;

    vector<int> a(n);
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
    }
    int value = accumulate(a.begin(), a.end(), 0) / 2;
    sort(a.begin(), a.end());
    //cout<<a[0]<<a[1]<<a[2]<<endl;
    int mine = 1;
    size_t i = 1;
    while (mine <= value)
    {
        mine += a[i++];

    }

    cout << i << endl;
    return 0;
}


include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int a[n];
    int sum=0;
    for (int i=0;i!=n;i++){
        cin>>a[i];
        sum=sum+a[i];
    }
    sort (a,a+n);
    int r=n-1;
    int cnt=0;
    int sum1=0;
    while(sum1<=sum&&r>=0)
    {
        sum1+=a[r--];
        sum=sum-sum1;
        ++cnt;
    }
    cout<<cnt;


#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin>>n;
    int sum=0;
    int a[n];
    for (int i=0;i!=n;i++)
    {
       cin>>a[i];
       sum=sum+a[i];

    }
    sort(a,a+n);
    int l=0,r=n-1;
    int ans2=0,cnt=0;
    while(ans2<=sum)
    {
        ans2=ans2+a[l++];   ;
        sum=sum-ans2;
        ++cnt;
    }
    cout<<cnt;

}


#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin>>n;
    int sum=0;
    int a[n];
    for (int i=0;i!=n;i++)
    {
       cin>>a[i];
       sum=sum+a[i];

    }
    sort(a,a+n);
    int l=0,r=n-1;
    int ans2=0,cnt=0;
    while(ans2<=sum)
    {
        ans2=ans2+a[r--];   ;
        sum=sum-ans2;
        ++cnt;
    }
    cout<<cnt;

}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int a[n];
    int sum=0;
    for (int i=0;i!=n;i++){
        cin>>a[i];
        sum=sum+a[i];
    }
    sort (a,a+n);
    int r=n-1;
    int cnt=0;
    int sum1=0;
    while(sum1<=sum&&r>=0)
    {
        sum1+=a[r--];
        sum=sum-a[r--];
        ++cnt;
    }
    cout<<cnt;
}


#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin>>n;
    int sum=0;
    int a[n];
    for (int i=0;i!=n;i++)
    {
       cin>>a[i];
       sum=sum+a[i];

    }
    sort(a, a+n, greater<int>());
    int l=0,r=n-1;
    int ans2=0,cnt=0;
    while(sum>=0)
    {
        ans2=ans2+a[l++];   ;
        sum=sum-ans2;
        ++cnt;
    }
    cout<<cnt;

}


#include <bits/stdc++.h>
using namespace std;
int main () {
    int n;
    cin >> n;
    int a[n];
    int sum=0;
    for(int i=0;i<n;i++) { cin >> a[i];sum=sum+a[i];
    }
    sort(a,a+n);
    int t=0; int r; int i=0;
    while(i<n) {
        t = t + a[i];
        if(t>(sum/2)) {
        r=i; break;
        else
        i++;
    }
    cout << r;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin>>n;
    int sum=0;
    int a[n];
    for (int i=0;i!=n;i++)
    {
       cin>>a[i];
       sum=sum+a[i];

    }
    sort(a, a+n, greater<int>());
    int l=0,r=n-1;
    int ans2=0,cnt=0;
    while(ans2<=sum)
    {
        ans2=ans2+a[l++];   ;
        sum=sum-ans2;
        ++cnt;
    }
    cout<<cnt;

}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int a[n];
    int sum=0;
    for (int i=0;i!=n;i++){
        cin>>a[i];
        sum=sum+a[i];
    }
    sort (a,a+n);
    int r=n-1;
    int cnt=0;
    int sum1=0;
    while(sum1<=sum&&r>=0)
    {
        sum1+=a[r--];
        sum=sum-sum1;
        ++cnt;
    }
    cout<<cnt;

}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int a[n];
    int sum=0;
    for (int i=0;i!=n;i++){
        cin>>a[i];
        sum=sum+a[i];
    }
    sort (a,a+n);
    int r=n-1;
    int cnt=0;
    int sum1=0;
    while(sum1<=sum&&r>=0)
    {
        sum1+=a[r];
        sum=sum-a[r];
        ++cnt;
        --r;

    }
    cout<<cnt;
}


#include <bits/stdc++.h>
using namespace std;
int main () {
    int n;
    cin >> n;
    int a[n];
    for(int i=0;i<n;i++) { cin >> a[i]; }
    for(int i=0;i<(n-1);i++) {
        for(int j=i+1;j<=(n-1);j++) {
            if(a[i]<a[j]) {
            int t=a[0]; a[0]=a[n-1]; a[n-1]=t; }
        }
    }
    int sum=0;
    for(int i=0;i<n;i++) {
        sum = sum + a[i];
    }
    int t=0; int r; int i=0;
    while(i<n) {
        t = t + a[i];
        if(t>(sum/2)) {
        r=i; break; }
        else
        i++;
    }
    cout << r;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main () {
    int n;
    cin >> n;
    int a[n];
    for(int i=0;i<n;i++) { cin >> a[i]; }
    sort(a,a+n,greater<int>());
    int sum=0;
    for(int i=0;i<n;i++) {
        sum = sum + a[i];
    }
    int t=0; int r; int i=0;
    while(i<n) {
        t = t + a[i];
        if(t>(sum/2)) {
        r=i; break; }
        else
        i++;
    }
    cout << r+1;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int sum(int*a,int f,int l)
{  int sum=0;
    for(int i=f;i<l;i++){sum+=a[i];}
    return sum;
}
int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {cin>>a[i];}
    for(int i=0;i<n;i++)
    {
        for(int j=i;j<n;j++)
        {
            if(a[i]>a[j]){int t=a[i];a[i]=a[j];a[j]=t;
        }
    }
    }

    if(n==1)cout<<1;
    else{for(int i=0;i<n;i++)
               {if(sum(a,0,n-i)<sum(a,n-i,n))
               {cout<<i;break;}
                              else continue;
                }

        }

return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
     cin>>n;
     if(n==1){cout<<1;return 0;}
     int a[n];int total=0;
     for(int i=0;i<n;i++)
     {
         cin>>a[i];
         total+=a[i];
     }

     sort(a,a+n);int z=0,count=1;
     for(int i=n-1;i>=0;i--)
     { z+=a[i];
         if(z<=(total-z)) count++;
     }
     cout<<count;
     return 0;
}


#include <bits/stdc++.h>
using namespace std;
int sum(int*p,int f,int l)
{ int sum=0;
    for(int i=f;i<=l;i++)
    {
        sum+=*(p+i);
    }
    return sum;
}
int main()
{
                int n;
                 cin>>n;
                 if(n==1){cout<<1;return 0;}
                 int a[n];
                 for(int i=0;i<n;i++)
                 {
                                 cin>>a[i];
                 }
                 int count =1;

                 sort(a,a+n);int total=(&a[0],0,n-1);

                 for(int i=n-2;i>=0;i--)
                 {
                     if(sum(&a[0],0,i)>=(total-sum(&a[0],0,i))) count++;

                 }
                 cout<<count;
                 return 0;
}


#include <bits/stdc++.h>
using namespace std;
int sum(int*a,int f,int l)
{  int sum=0;
    for(int i=f;i<l;i++){sum+=a[i];}
    return sum;
}
int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {cin>>a[i];}
    for(int i=0;i<n;i++)
    {
        for(int j=i;j<n;j++)
        {
            if(a[i]>a[j]){int t=a[i];a[i]=a[j];a[j]=t;
        }
    }
    }

    if(n==1)cout<<"1";
    else{for(int i=0;i<n;i++){if(sum(a,0,n-i)<sum(a,n-i,n)) {cout<<i+1;}
}

    }

return 0;
}


#include <bits/stdc++.h>
using namespace std;
int sum(int*a,int f,int l)
{  int sum=0;
    for(int i=f;i<=l;i++){sum+=a[i];}
    return sum;
}
int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        for(int j=i;j<n;j++)
        {
            if(a[i]>a[j]){int t=a[i];a[i]=a[j];a[j]=t;
        }
    }
    }

    for(int i=0;i<n;i++){if(sum(a,0,n-i-2)<sum(a,n-1-i,n-1)) {cout<<i;break;}
}

return 0;
}


#include <bits/stdc++.h>
using namespace std;
int sum(int*p,int f,int l)
{ int sum=0;
    for(int i=f;i<=l;i++)
    {
        sum+=*(p+i);
    }
    return sum;
}
int main()
{
                int n;
                 cin>>n;
                 if(n==1){cout<<1;return 0;}
                 int a[n];
                 for(int i=0;i<n;i++)
                 {
                                 cin>>a[i];
                 }
                 int count=-1;

                 sort(a,a+n);int total=(&a[0],0,n-1);

                 for(int i=n-1;i>=0;i--)
                 {
                     if(sum(&a[0],0,i)>=(total-sum(&a[0],0,i))) count++;
                     else {cout<<count;return 0;}
                 }
                 cout<<count+1;
                 return 0;
}


#include <bits/stdc++.h>
using namespace std;
int sum(int*a,int f,int l)
{  int sum=0;
    for(int i=f;i<=l;i++){sum+=a[i];}
    return sum;
}
int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        for(int j=i;j<n;j++)
        {
            if(a[i]>a[j]){int t=a[i];a[i]=a[j];a[j]=t;
        }
    }

    for(int i=0;i<n;i++){if(sum(a,0,n-i-2)<sum(a,n-1-i,n-1)) {cout<<i+1;break;}
}


#include <bits/stdc++.h>
using namespace std;
int sum(int*a,int f,int l)
{  int sum=0;
    for(int i=f;i<=l;i++){sum+=a[i];}
    return sum;
}
int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        for(int j=i;j<n;j++)
        {
            if(a[i]>a[j]){int t=a[i];a[i]=a[j];a[j]=t;
        }
    }
    }

    for(int i=0;i<n;i++){if(sum(a,0,n-i-2)<sum(a,n-1-i,n-1)) {cout<<i+1;break;}
}

return 0;
}


#include <bits/stdc++.h>
using namespace std;

int sum(int*p,int f,int l)
{ int sum=0;
    for(int i=f;i<=l;i++)
    {
        sum+=*(p+i);
    }
    return sum;
}

int sum(int a[],int n)
{ int s=0;
    for(int i=0;i<n;i++) s+=a[i];
    return s;
}

int main()
{
                int n;
                 cin>>n;
                 if(n==1){cout<<1;return 0;}
                 int a[n];
                 for(int i=0;i<n;i++)
                 {
                                 cin>>a[i];
                 }
                 int count=0;

                 sort(a,a+n);
                 int total=sum(a,0,n-1);

                int z=0;
                 for(int i=n-1;i>=0;i--)
                 {
                 z+=a[i];
                 if(z<= (total/2)) count++;
                 }
                 cout<<count+1;
                 return 0;
}


#include <bits/stdc++.h>
using namespace std;
int sum(int*a,int f,int l)
{  int sum=0;
    for(int i=f;i<l;i++){sum+=a[i];}
    return sum;
}
int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {cin>>a[i];}
    for(int i=0;i<n;i++)
    {
        for(int j=i;j<n;j++)
        {
            if(a[i]>a[j]){int t=a[i];a[i]=a[j];a[j]=t;
        }
    }
    }

    if(n==1)cout<<1;
    else{for(int i=0;i<n;i++){if(sum(a,0,n-i)<sum(a,n-i,n)) {cout<<i;break;}
}

    }

return 0;
}


#include <bits/stdc++.h>
using namespace std;
int sum(int*a,int f,int l)
{  int sum=0;
    for(int i=f;i<l;i++){sum+=a[i];}
    return sum;
}
int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        for(int j=i;j<n;j++)
        {
            if(a[i]>a[j]){int t=a[i];a[i]=a[j];a[j]=t;
        }
    }
    }

    if(n==1)cout<<1;
    else{for(int i=0;i<n;i++){if(sum(a,0,n-i)<sum(a,n-i,n)) {cout<<i;break;}
}

    }

return 0;
}


#include <bits/stdc++.h>
using namespace std;
int sum(int*p,int f,int l)
{
    int sum;
    for(int i=f;i<=l;i++)
    {
        sum+=*(p+i);
    }
    return sum;
}
int main()
{
    int n;
    cin>>n;
    int a[n];
    sort(a,a+n);
    int f=n-2;
    int l=n-1;
    if(n==1) cout<<1;
    else
    {
    while(f>=0)
    {if(f==0) {cout<<n;return 0;}
    if(sum(a,0,f-1)<sum(a,f,l)) {cout<<l-f+1;return 0;}
    else f--;
    }
    }
return 0;
}


#include <bits/stdc++.h>
using namespace std;
int sum(int*p,int f,int l)
{ int sum=0;
    for(int i=f;i<=l;i++)
    {
        sum+=*(p+i);
    }
    return sum;
}
int main()
{
                int n;
                 cin>>n;
                 if(n==1){cout<<1;return 0;}
                 int a[n];
                 for(int i=0;i<n;i++)
                 {
                                 cin>>a[i];
                 }
                 int count=-1;

                 sort(a,a+n);int total=(&a[0],0,n-1);

                 for(int i=n-1;i>=0;i--)
                 {
                     if(sum(&a[0],0,i)>=(total-sum(&a[0],0,i))) count++;
                     else continue;
                 }
                 cout<<n-count+1;
                 return 0;
}


#include <bits/stdc++.h>
using namespace std;
int sum(int*a,int f,int l)
{  int sum=0;
    for(int i=f;i<l;i++){sum+=a[i];}
    return sum;
}
int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {cin>>a[i];}
    for(int i=0;i<n;i++)
    {
        for(int j=i;j<n;j++)
        {
            if(a[i]>a[j]){int t=a[i];a[i]=a[j];a[j]=t;
        }
        }
    }

    if(n==1)cout<<"1";
    else{for(int i=0;i<n;i++){if(sum(a,0,n-i)<sum(a,n-i,n)) {cout<<i+1;}
                              }
         }

return 0;
}


#include <bits/stdc++.h>
using namespace std;
int sum(int*p,int f,int l)
{ int sum=0;
    for(int i=f;i<=l;i++)
    {
        sum+=*(a+i);
    }
    return sum;
}
int main()
{
                int n;
                 cin>>n;
                 if(n==1){cout<<1;return 0;}
                 int a[n];
                 for(int i=0;i<n;i++)
                 {
                                 cin<<a[i];
                 }

                 sort(a,a+n);

                 for(int i=2;i<=n;i++)
                 {
                     int a=sum(a,0,n-i);
                     int b=sum(a,n-i+1,n-1);
                     if(b>a) {cout<<i-1;}
                     else if(i==n) cout<<n;
                 }
                 return 0;
}


#include <bits/stdc++.h>
using namespace std;
int sum(int*p,int f,int l)
{
    int sum=0;
    for(int i=f;i<=l;i++)
    {
        sum+=*(p+i);
    }
    return sum;
}
int main()
{
    int n;
    cin>>n;
     if(n==1) {cout<<1;return 0;}
    int a[n];
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        {int temp;
            if(a[i]>a[j]){ temp=a[i];a[i]=a[j];a[j]=temp;}
        }
    }
    int f=n-2;
    int l=n-1;

    while(f>=-1)
    {if(f==-1) {cout<<n;return 0;}
    else if(sum(a,0,f-1)>=sum(a,f,l)) {f--;}
    else if(sum(a,0,f-1)<sum(a,f,l)) {cout<<l-f+1; return 0;}
    }

return 0;
}


#include <bits/stdc++.h>
using namespace std;
int sum(int*p,int f,int l)
{
    int sum;
    for(int i=f;i<=l;i++)
    {
        sum+=*(a+i);
    }
    return sum;
}
int main()
{
    int n;
    cin>>n;
    int a[n];
    sort(a,n);
    int f=n-2;
    int l=n-1;
    while(f>=0)
    {if(f==0) {cout<<n;return 0;}
    if(sum(a,0,l-1)<sum(a,f,l)) {cout<<l-f+1;return 0;}
    else f--;
    }
return 0;
}


#include <stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
    int sum=0, sum2=0;
    int x,s,m,i,j,t;
    int *arr;
    long n;
    scanf("%d", &t);
    while(t--)
    {
        s =2;
        sum =0;
        sum2 =0;
        scanf("%ld", &n);
        arr = (int *)malloc(sizeof(int)*n);
        for( i=0; i<n/2; i++)
        {
            arr[i] = s;
            sum = sum + arr[i];
            s = s+2;
        }
        s =1;
        for(j=n/2; j<n; j++)
        {
            sum2 += s;
            if(sum-sum2>0 &&  j!= n-1)
            {
                arr[j]= s;
                s= s+2;
                continue;
            }
            if(j==n-1)
            {
              	sum2 = sum2 -s;
              	x = sum - sum2;
                if(x%2 !=0){
                    arr[j] = x;
                    x =-1;
                }
            }
        }
        if(x==-1)
        {
        	printf("YES\n");
            for(m =0; m<n;m++)
                printf("%d ", arr[m]);
        }
        else
        	printf("NO\n");
		free(arr);
    }
    return 0;
}


#include <stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
    int sum=0, sum2=0;
    int x,s,n,m,i,j,t;
    int *arr;
    scanf("%d", &t);
    while(t--)
    {
        s =2;
        sum =0;
        sum2 =0;
        scanf("%d", &n);
        arr = (int *)malloc(sizeof(int)*n);
        for( i=0; i<n/2; i++)
        {
            arr[i] = s;
            sum = sum + arr[i];
            s = s+2;
        }
        s =1;
        for(j=n/2; j<n; j++)
        {
            sum2 += s;
            if(sum-sum2>0 &&  j!= n-1)
            {
                arr[j]= s;
                s= s+2;
                continue;
            }
            if(j==n-1)
            {
              	sum2 = sum2 -s;
              	x = sum - sum2;
                if(x%2 !=0){
                    arr[j] = x;
                    printf("YES\n");
                    x =-1;
                }
                else
                    printf("NO\n");
            }
        }
        if(x==-1)
        {
            for(m =0; m<n;m++)
                printf("%d ", arr[m]);
            printf("\n");
        }
		free(arr);

    }
    return 0;
}


#include<stdio.h>
#include<string.h>
int main()
{
   int t,i,n;
    scanf("%d",&t);
    while(t--){
        scanf("%d",&n);
        if(n%4!=0)
        printf("NO\n");
        else{
            printf("YES\n");
            for(i=1;i<=n/2;i++)
            printf("%d ",2*i);
            for(i=1;i<=n/2;i++)
            printf("%d ",2*i-1);

            printf("%d ",3*n/2-1);
        }
    }
    return 0;
}


#include<stdio.h>
#include<string.h>
int main()
{
   int t,i,n;
    scanf("%d",&t);
    while(t--){
        scanf("%d",&n);
        if(n%4!=0)
        printf("NO\n");
        else{
            printf("YES\n");
            for(i=1;i<=n/2;i++)
            printf("%d ",2*i);
            for(i=1;i<n/2;i++)
            printf("%d ",2*i-1);

            printf("%d\n",3*i-1);
        }
    }
    return 0;
}


#include <stdio.h>
#include <math.h>

int main()
 {
     int n, t, x, y, i;
     scanf("%d", &t);
     while(t--) {
        scanf("%d", &n);
        if(n % 4 == 0) {
            printf("YES\n");
            n /= 2;
            x = 0;
            y = -1;
            for(i = 0; i < n; i++) printf("%d ", x += 2);
            for(i = 0; i < n; i++) printf("%d%c", y += 2, " \n"[i == n-1]);
        }
        else printf("NO\n");
     }
     return 0;

 }


#include <stdio.h>
#include <math.h>

int main()
 {
     int n, t, x, y, i, sum;
     scanf("%d", &t);
     while(t--) {
        scanf("%d", &n);
        if(n % 4 == 0) {
            printf("YES\n");
            n /= 2;
            sum = n * (n + 1);
            x = 0;
            y = 1;
            for(i = 0; i < n; i++) printf("%d ", x += 2);
            for(i = 0; i < n; i++) {
                if(i < n - 1) printf("%d ", y);
                else printf("%d\n", sum);
                sum -= y;
                y += 2;
            }

        }
        else printf("NO\n");
     }
     return 0;

 }


#include <stdio.h>
#include <math.h>

int main()
 {
     int n, t, x, y, i, sum;
     scanf("%d", &t);
     while(t--) {
        scanf("%d", &n);
        if(n % 4 == 0) {
            printf("YES\n");
            sum = (n * n) / 4 + n / 2;
            x = 0;
            y = 1;
            for(i = 0; i < n/2; i++) printf("%d ", x += 2);
            for(i = 0; i < n/2; i++) {
                if(i < n/2 - 1) printf("%d ", y);
                else printf("%d\n", sum);
                sum -= y;
                y += 2;
            }

        }
        else printf("NO\n");
     }
     return 0;

 }


#include <stdio.h>

int main()
{
    int c;

    scanf("%d", &c);

    while (c)
    {
        int n;
        scanf("%d", &n);
        if (n % 4 != 0)
        {
            printf("NO\n");
            continue;
        }
        printf("YES\n");
        n /= 2;
        for (int i = 1 ; i <= n; i++)
            printf("%d ", i * 2);
        for (int i = 1; i < n; i++)
            printf("%d ", i * 2 - 1);
        printf("%d\n", 3 * n - 1);
        c--;
    }

    return 0;
}


#include <stdio.h>

int main()
{
    int c;

    scanf("%d", &c);

    while (c--)
    {
        int n;
        scanf("%d", &n);
        if (n % 4 != 0)
        {
            printf("NO\n");
            continue;
        }
        printf("YES\n");
        n /= 2;
        for (int i = 1 ; i <= n; i++)
            printf("%d ", i * 2);
        for (int i = 1; i < n; i++)
            printf("%d ", i * 2 - 1);
        printf("%d\n", 3 * n - 1);
    }

    return 0;
}


#include<stdio.h>
void main(){
	int t;
	scanf("%d",&t);
	while(t!=0){
		int n;
		scanf("%d",&n);
		if((n/2)%2==0){

			printf("YES\n");
			int sum=0;
			int oddsum=0;
			int even=2;
			int odd=1;
			for(int i=0;i<n/2;i++){
				oddsum=oddsum+odd
				printf("%d ",even);
				even=even+2;
			}
			for(int i=n/2;i<n-1;i++){
				oddsum=oddsum+odd
				printf("%d ",odd);
				odd=odd+2;
			}
			printf("%d\n",(sum-oddsum));

		}
		else{
			printf("NO\n");
		}
		t--;
	}
}


#include<stdio.h>
void main(){
	int t;
	scanf("%d",&t);
	while(t!=0){
		int n;
		scanf("%d",&n);
		if(n%2==0){
		if((n/2)%2==0){
			printf("YES\n");
			int sum=0;
			int even=2;
			int odd=1;
			for(int i=0;i<n/2;i++){
				printf("%d ",even);
				even=even+2;
			}
			for(int i=n/2;i<n-1;i++){
				printf("%d ",odd);
				odd=odd+2;
			}
			printf("%d\n",(even-odd));}
			else{
				printf("NO\n");
			}

		}
		else{
			printf("NO\n");
		}
		t--;
	}
}


#include<stdio.h>
void main(){
	int t;
	scanf("%d",&t);
	while(t!=0){
		int n;
		scanf("%d",&n);
		if((n/2)%2==0){

			printf("YES\n");
			int sum=0;
			int oddsum=0;
			int even=2;
			int odd=1;
			for(int i=0;i<n/2;i++){
				sum=sum+odd;
				printf("%d ",even);
				even=even+2;
			}
			for(int i=n/2;i<n-1;i++){
				oddsum=oddsum+odd;
				printf("%d ",odd);
				odd=odd+2;
			}
			printf("%d\n",(sum-oddsum));

		}
		else{
			printf("NO\n");
		}
		t--;
	}
}


#include<stdio.h>
void main(){
	int t;
	scanf("%d",&t);
	while(t!=0){
		int n;
		scanf("%d",&n);
		if(n%2==0){
		if((n/2)%2==0){
			printf("YES\n");
			int sum=0;
			int even=2;
			int oddsum=0;
			int odd=1;
			for(int i=0;i<n/2;i++){
				printf("%d ",even);
				even=even+2;
				sum=sum+even;
			}
			for(int i=n/2;i<n-1;i++){
				printf("%d ",odd);
				odd=odd+2;
				oddsum=oddsum+odd;
			}
			printf("%d\n",(sum-oddsum));}
			else{
				printf("NO\n");
			}

		}
		else{
			printf("NO\n");
		}
		t--;
	}
}


#include<stdio.h>
void main(){
	int t;
	scanf("%d",&t);
	while(t!=0){
		int n;
		scanf("%d",&n);
		if((n/2)%2==0){

			printf("YES\n");
			int sum=0;
			int oddsum=0;
			int even=2;
			int odd=1;
			for(int i=0;i<n/2;i++){
				sum=sum+even;
				printf("%d ",even);
				even=even+2;
			}
			for(int i=n/2;i<n-1;i++){
				oddsum=oddsum+odd;
				printf("%d ",odd);
				odd=odd+2;
			}
			printf("%d\n",(sum-oddsum));

		}
		else{
			printf("NO\n");
		}
		t--;
	}
}


#include<stdio.h>
void main(){
	int t;
	scanf("%d",&t);
	while(t!=0){
		int n;
		scanf("%d",&n);
		if((n/2)%2==0){
			printf("YES\n");
			int sum=0;
			int even=2;
			int odd=1;
			for(int i=0;i<n/2;i++){
				printf("%d ",even);
				even=even+2;
			}
			for(int i=n/2;i<n-1;i++){
				printf("%d ",odd);
				odd=odd+2;
			}
			printf("%d\n",(even-odd));

		}
		else{
			printf("NO\n");
		}
		t--;

	}
}


#include<stdio.h>
void main(){
	int t;
	scanf("%d",&t);
	while(t!=0){
		int n;
		scanf("%d",&n);
		if((n/2)%2==0){
			printf("YES\n");
			int sum=0;
			int even=2;
			int odd=1;
			for(int i=0;i<n/2;i++){
				printf("%d ",even);
				even=even+2;
			}
			for(int i=n/2;i<n-1;i++){
				printf("%d ",odd);
				odd=odd+2;
			}
			printf("%d\n",(even-odd));

		}
		else{
			printf("NO\n");
		}
	}
}


#include<stdio.h>
int main(){
	int t;
	scanf("%d",&t);
	while(t!=0){
		int n;
		scanf("%d",&n);
		int k=n/2;
		if(k%2==0){
			printf("YES\n");
			int sume=0,even=2,odds=0,odd=1;
			int i;
			for(i=0;i<k;i++){
				sume=even+sume;
				printf("%d ",even);
				even=even+2;
			}
			for(i=0;i<k-1;i++){
				odds=odds+odd;

				printf("%d ",odd);
				odd=odd+2;
			}
			sume=sume-odds;
			printf("%d\n",sume);

		}
		else{
			printf("NO\n");
		}

		t--;
	}
}


#include<stdio.h>
int main()
{
    int t,n,i;
    scanf("%d",&t);
    while(t--)
    {
        int ev=2,od=1,sum1=0,sum2=0,diff;
        scanf("%d",&n);
        int a[n];
        if(n%4!=0)
            printf("NO\n");
        else
        {
            printf("YES\n");
            for(i=1;i<=n/2;i++)
            {
                printf("%d ",ev);
                ev=ev+2;
                sum1=sum1+ev;
            }

            for(i=1;i<=(n/2)-1;i++)
            {
                printf("%d ",od);
                od=od+2;
                sum2=sum2+od;
            }
        diff=sum1-sum2-2;
        printf("%d\n",diff);
        }

    }
     return 0;

}


#include<stdio.h>
int main()
{
    int t,n,i;
    scanf("%d",&t);
    while(t--)
    {
        int ev=2,od=1,sum1=0,sum2=0,diff;
        scanf("%d",&n);
        int a[n];
        if(n%4!=0)
            printf("NO\n");
        else
        {
            printf("YES\n");
            for(i=1;i<=n/2;i++)
            {
                printf("%d ",ev);
                ev=ev+2;
                sum1=sum1+ev;
            }

            for(i=1;i<=(n/2)-1;i++)
            {
                printf("%d ",od);
                od=od+2;
                sum2=sum2+od;
            }
        diff=sum1-sum2-2;
        printf("%d\n",diff);
        }

        return 0;

    }

}


#include <stdio.h>
#include <math.h>
#define ll long long
int main()
{
    int i,n,j;
    scanf("%d",&n);
    int ara[n+1];
    for(i = 1; i <= n; i++){
        scanf("%d",&ara[i]);
    }
    for(i = 1; i <= n; i++){
        if (ara[i] % 4 == 0) {
            printf("%YES\n");
            for(j = 1; j <= ara[i]/2; j++) {
                printf("%d ",2*j);
            }
            for(j = 1; j < ara[i]/2; j++) {
                printf("%d ",2*j - 1);
            }
            printf("%d", ara[i] + ara[i]/2 - 1);
            printf("\n");
        }
        else printf("NO\n");
    }

    return 0;
}


#include <stdio.h>
#include <math.h>
#define ll long long
int main()
{
    int i,n,j;
    scanf("%d",&n);
    int ara[n+1];
    for(i = 1; i <= n; i++){
        scanf("%d",&ara[i]);
    }
    for(i = 1; i <= n; i++){
        if (ara[i] % 4 == 0) {
            printf("YES\n");
            for(j = 1; j <= ara[i]/2; j++) {
                printf("%d ",2*j);
            }
            for(j = 1; j < ara[i]/2; j++) {
                printf("%d ",2*j - 1);
            }
            printf("%d", ara[i] + ara[i]/2 - 1);
            printf("\n");
        }
        else printf("NO\n");
    }

    return 0;
}


#include<stdio.h>

int main(){
    int t;
    scanf("%d",&t);
    for(int i=0;i<t;i++){
        long int n;
        scanf("%ld",&n);
        if(n%4 != 0){
            printf("NO\n");
            continue;
        }
        long a[n];
        for(long i=0;i<(n/2);i++){
            a[i] = 2*(i+1);
            a[i+(n/2)]  = 2*i+1;
        }
        for(long i=0;i<n;i++){
            printf("%ld ",a[i]);
        }
        printf("\n");
    }
}


#include<stdio.h>

int main(){
    int t;
    scanf("%d",&t);
    for(int i=0;i<t;i++){
        long int n;
        scanf("%ld",&n);
        if(n%4 != 0){
            printf("NO\n");
            continue;
        }
        else{
            printf("YES\n");
        }
        long a[n];
        for(long i=0;i<(n/2);i++){
            a[i] = 2*(i+1);
            a[i+(n/2)]  = 2*i+1;
        }
        for(long i=0;i<n;i++){
            printf("%ld ",a[i]);
        }
        printf("\n");
    }
}


#include<stdio.h>

int main(){
    int t;
    scanf("%d",&t);
    for(int i=0;i<t;i++){
        long int n;
        scanf("%ld",&n);
        if(n%4 != 0){
            printf("NO\n");
            continue;
        }
        else{
            printf("YES\n");
        }
        long a[n];
        for(long i=0;i<(n/2);i++){
            a[i] = 2*(i+1);
            a[i+(n/2)]  = 2*i+1;
        }
        a[n-1] += (n/2);
        for(long i=0;i<n;i++){
            printf("%ld ",a[i]);
        }
        printf("\n");
    }
}


#include <stdio.h>
int main()
{
    int n, i,  t;
    scanf("%d", &t);
    while (t--)
    {
        scanf("%d", &n);
        if(n/2 % 2)
        {
            printf("NO\n");
            continue;
        }
        printf("YES\n");
        for (i = 2; i <= n; i += 2)
            printf("%d ", i);
        for (i = 1; i < n - 2; i += 2)
            printf("%d ", i);
        printf("%d\n", 3 * n/2 - 1);
    }
    return 0;
}


#include <stdio.h>
int main()
{
    int n, i,  t;
    scanf("%d", &t);
    while (t--)
    {
        scanf("%d", &n);
        if(n/2 % 2)
        {
            printf("NO\n");
            continue;
        }
        printf("YES\n");
        for (i = 2; i <= n; i += 2)
            printf("%d ", i);
        for (i = 1; i < n; i += 2)
            printf("%d ", i);
        printf("\n");
    }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main()
{
	int t,n;
	scanf("%d",&t);
	while(t--)
	{
		scanf("%d",&n);
		int a[n],x,i;
		x=n/2;
		if(x%2!=0)
		printf("NO\n");
		else
		{int y=2;
		int z=y-1;
		printf("YES\n");
			for(i=0;i<x;i++)
			{
				if(i%2==0)
				z=y-1;
				else
				z=y+1;

				a[i]=y;
				a[x+i]=z;
				y+=2;
			}
		for(i=0;i<n;i++)
		printf("%d ",a[i]);
		printf("\n");
		}

	}
	return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main()
{
	int t,n;
	scanf("%d",&t);
	while(t--)
	{
		scanf("%d",&n);
		int a[n],x,i;
		x=n/2;
		if(x%2!=0)
		printf("NO\n");
		else
		{int y=2,sum_e=0,sum_o=0;

		printf("YES\n");
			for(i=0;i<x;i++)
			{
				a[i]=y;
				y+=2;
				sum_e+=a[i];
			}
			y=1;
		for(i=0;i<x;i++)
		{
			a[i+x]=y;
			y+=2;
			sum_o+=a[i+x];
			if(i==x-2)
			y=sum_e-sum_o;
		}
		for(i=0;i<n;i++)
		printf("%d ",a[i]);
		printf("\n");
		}

	}
	return 0;
}


    #include <stdio.h>
    int main()
    {
    	int T,i,n;
    	scanf("%d",&T);
    	while(T--)
    	{
    		scanf("%d",&n);
    		if(n%4)
    			printf("NO\n");
    		else
    		{
    			printf("YES\n");
    			for(i=1;i<=n/2;i++)
    				printf("%d ",2*i);
    			for(i=1;i<n/2;i++)
    				printf("%d ",2*i-1);
    			printf("%d\n",3*i-1);
    		}
    	}

    }


#include <stdio.h>

int sum(int arr[], int n)
{
    int total = 0;
    for(int i = 0; i < n; i++)
        total += arr[i];
    return total;
}

int main()
{
    int t;
    scanf("%d", &t);
    int n, sum_of_even, sum_of_odd, diff;
    while(t--) {
    scanf("%d", &n);
    int arr[n], even = 2, odd = 1, total = 0;
    for(int i = 0; i < n/2; i++)
    {
        arr[i] = even;
        even += 2;
    }
    for(int i = n/2; i < n-1; i++)
    {
        arr[i] = odd;
        odd += 2;
        total += arr[i];
    }
    sum_of_even = sum(arr, n/2);
    diff = sum_of_even - total;
    if(diff%2)
    {
        arr[n-1] = diff;
        printf("YES\n");
        for(int i = 0; i < n; i++)
            printf("%d ", arr[i]);
        printf("\n");
    }
    else
        printf("NO\n");
    }
    return 0;
}


#include <stdio.h>

int sum(int arr[], int n)
{
    int total = 0;
    for(int i = 0; i < n; i++)
        total += arr[i];
    return total;
}

int main()
{
    int t;
    scanf("%d", &t);
    int n, sum_of_even, sum_of_odd, diff;
    while(t--) {
    scanf("%d", &n);
    int arr[n], even = 0, odd = 1, total = 0;
    for(int i = 0; i < n/2; i++)
    {
        arr[i] = even;
        even += 2;
    }
    for(int i = n/2; i < n-1; i++)
    {
        arr[i] = odd;
        odd += 2;
        total += arr[i];
    }
    sum_of_even = sum(arr, n/2);
    diff = sum_of_even - total;
    if(diff%2)
    {
        arr[n-1] = diff;
        printf("YES\n");
        for(int i = 0; i < n; i++)
            printf("%d ", arr[i]);
        printf("\n");
    }
    else
        printf("NO\n");
    }
    return 0;
}


#include<stdio.h>
int main()
{
    int t,i,n;
    scanf("%d",&t);
    for(i=1;i<=t;i++)
    {
        scanf("%d",&n);
         if(n%2==0)
        {
        int a;
        a=n/2;
        if(a%2==1)
        printf("NO\");
        else if(a%2==0)
            {
                int j,k,z,sum1=0,sum2=0;
                printf("YES\n");
                for(j=2;j<=n;j=j+2)
               {
                printf("%d ",j);
                  sum1=sum1+j;
                }
                for(k=1;k<=n-3;k=k+2)
                {
                    printf("%d ",k);
                    sum2=sum2+k;
                }
                z=sum1-sum2;
                printf("%d ",z);
            }

        }
    }
}


#include<stdio.h>
int main()
{
    int t,i,n;
    scanf("%d",&t);
    for(i=1;i<=t;i++)
    {
        scanf("%d",&n);
         if(n%2==0)
        {
        int a;
        a=n/2;
        if(a%2==1)
        printf("NO");
        else if(a%2==0)
            {
                int j,k,z,sum1=0,sum2=0;
                printf("YES\n");
                for(j=2;j<=n;j=j+2)
               {
                printf("%d ",j);
                  sum1=sum1+j;
                }
                for(k=1;k<=n-3;k=k+3)
                {
                    printf("%d ",k);
                    sum2=sum2+k;
                }
                z=sum1-sum2;
                printf("%d ",z);
            }

        }
    }
}


#include<stdio.h>
int main()
{
    int t,i,n;
    scanf("%d",&t);
    for(i=1;i<=t;i++)
    {
        scanf("%d",&n);
         if(n%2==0)
        {
        int a;
        a=n/2;
        if(a%2==1)
        printf("NO\n");
        else if(a%2==0)
            {
                int j,k,z; long long int sum1=0,sum2=0;
                printf("YES\n");
                for(j=2;j<=n;j=j+2)
               {
                printf("%d ",j);
                  sum1=sum1+j;
                }
                for(k=1;k<=n-3;k=k+2)
                {
                    printf("%d ",k);
                    sum2=sum2+k;
                }
                z=sum1-sum2;
                printf("%d ",z);
            }

        }
    }
}


#include<stdio.h>
int main()
{
    int t,i,n;
    scanf("%d",&t);
    for(i=1;i<=t;i++)
    {
        scanf("%d",&n);
         if(n%2==0)
        {
        int a;
        a=n/2;
        if(a%2==1)
        printf("NO");
        else if(a%2==0)
            {
                int j,k,z,sum1=0,sum2=0;
                printf("YES\n");
                for(j=2;j<=n;j=j+2)
               {
                printf("%d ",j);
                  sum1=sum1+j;
                }
                for(k=1;k<=n-3;k=k+2)
                {
                    printf("%d ",k);
                    sum2=sum2+k;
                }
                z=sum1-sum2;
                printf("%d ",z);
            }

        }
    }
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

int main(){
	int t;
	long n;
	scanf("%d",&t);
	while(t--){
		scanf("%ld",&n);
		if(n/2%2)
			printf("NO\n");
		else{
			printf("YES\n");
			for(long i=1 ; i<=n/2 ; i++)
				printf("%ld ", 2*i);
			for (long i = 1; i < n/2; ++i)
				printf("%ld ", 2*i-1);
			printf("%ld\n", (n/2-1)+n);
		}
	}
	return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

int main(){
	int t;
	long n;
	scanf("%d",&t);
	while(t--){
		scanf("%ld",&n);
		if(n/2%2)
			printf("NO\n");
		else{
			for(long i=1 ; i<=n/2 ; i++)
				printf("%ld ", 2*i);
			for (long i = 1; i < n/2; ++i)
				printf("%ld ", 2*i-1);
			printf("%ld\n", (n/2-1)+n);
		}
	}
	return 0;
}


#include<stdio.h>
int main()
{
    int t;
    scanf("%d",&t);
    while(t>0){
        int n,i,j,sume = 0,sumo = 0;
        scanf("%d",&n);
       if(n%2==1 || n==2 || (n/2)%2==1){
        printf("NO");
       }
       else {
            for(i=2;i<=n;i+=2){
                sume += i;
                printf("%d ",i);
            }
            for(i=1;i<(n-1);i+=2){
                sumo += i;
                printf("%d ",i);
            }
                printf("%d ",sume-sumo);
            }

        t--;
        printf("\n");
    }

    return 0;

}


#include<stdio.h>
int main()
{
    int t;
    scanf("%d",&t);
    while(t>0){
        int n,i,j,sume = 0,sumo = 0;
        scanf("%d",&n);
       if(n%2==1 || n==2 || (n/2)%2==1){
        printf("NO");
       }
       else {
            printf("YES\n");
            for(i=2;i<=n;i+=2){
                sume += i;
                printf("%d ",i);
            }
            for(i=1;i<(n-1);i+=2){
                sumo += i;
                printf("%d ",i);
            }
                printf("%d ",sume-sumo);
            }

        t--;
        printf("\n");
    }

    return 0;

}


#include<stdio.h>
#include<string.h>
#include<math.h>
#define pow
int main()
{
    long long int n,k,i,a[1000000];
    scanf("%lld",&n);
    while(n--)
    {
        scanf("%lld",&k);
        if(k%4!=0)
        printf("NO");
        else
        {printf("YES\n");
            for(i=1;i<=k;i++)
                a[i]=i*2;
            for(i=k+1;i<=2*k;i++)
            {
                a[i]=a[i-k]-1;
                a[i+1]=a[i];
                i++;
            }
            for(i=1;i<=2*k;i++)
            printf("%lld ",a[i]);
        }
        printf("\n");
    }
}


#include<stdio.h>
#include<string.h>
#include<math.h>
#define pow
int main()
{
    long long int n,k,i,a[1000000],fs=0,ss=0;
    scanf("%lld",&n);
    while(n--)
    {fs=0,ss=0;
        scanf("%lld",&k);
        if(k%4!=0)
        printf("NO");
        else
        {printf("YES\n");
            for(i=1;i<=k/2;i++)
               { a[i]=i*2; fs+=a[i]; }
            for(i=k/2+1;i<k;i++)
            {
                a[i]=a[i-k/2]-1; ss+=a[i];
            }
            a[i]=fs-ss;
            for(i=1;i<=k;i++)
            printf("%lld ",a[i]);
        }
        printf("\n");
    }
}


#include<stdio.h>
#include<string.h>
#include<math.h>
#define pow
int main()
{
    long long int n,k,i,a[1000000];
    scanf("%lld",&n);
    while(n--)
    {
        scanf("%lld",&k);
        if(k%4!=0)
        printf("NO");
        else
        {printf("YES\n");
            for(i=1;i<=k/2;i++)
                a[i]=i*2;
            for(i=k/2+1;i<=k;i++)
            {
                a[i]=a[i-k/2]+1;
                a[i+1]=a[i];
                i++;
            }
            for(i=1;i<=k;i++)
            printf("%lld ",a[i]);
        }
        printf("\n");
    }
}


#include<conio.h>
#include<stdio.h>
int main()
{
    int t,n;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d",&n);
        int d=n/2;
        if(d%2!=0)
        {
            printf("NO\n");
            continue;
        }
        else
        {
             printf("YES\n");
            int a=2;
            for(int i=0;i<(n/2);i++)
            {
              printf("%d ",a);
              a=a+2;
            }
            int b=1;
            for(int j=(n/2);j<(n-1);j++)
            {
                printf("%d ",b);
                b=b+2;
            }
            printf("%d ",(b)+(n/2));
            printf("\n");
        }
    }
}


#include<conio.h>
#include<stdio.h>
int main()
{
    int t,n;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d",&n);
        int d=n/2;
        if(d%2!=0)
        {
            printf("No\n");
            continue;
        }
        else
        {
            int arr[n];
            int a=2;
            for(int i=0;i<=((n/2)-1);i++)
            {
              arr[i]=a;
              a=a+2;
            }
            int b=1;
            for(int j=(n/2);j<=(n-2);j++)
            {
                arr[j]=b;
                b=b+2;
            }
            arr[n-1]=(b)+(n/2);
            printf("YES\n");
            for(int i=0;i<n;i++)
            {
                printf("%d",arr[i]);
            }
            printf("\n");
        }
    }

}


#include<conio.h>
#include<stdio.h>
int main()
{
    int t,n;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d",&n);
        int d=n/2;
        if(d%2!=0)
        {
            printf("No\n");
            continue;
        }
        else
        {
             printf("YES\n");
            int a=2;
            for(int i=0;i<=(n/2);i++)
            {
              printf("%d ",a);
              a=a+2;
            }
            int b=1;
            for(int j=(n/2);j<(n-1);j++)
            {
                printf("%d ",b);
                b=b+2;
            }
            printf("%d ",(b)+(n/2));
            printf("\n");
        }
    }
}


#include<conio.h>
#include<stdio.h>
int main()
{
    int t,n;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d",&n);
        int d=n/2;
        if(d%2!=0)
        {
            printf("No\n");
            continue;
        }
        else
        {
            int arr[n];
            int a=2;
            for(int i=0;i<=((n/2)-1);i++)
            {
              arr[i]=a;
              a=a+2;
            }
            int b=1;
            for(int j=(n/2);j<=(n-2);j++)
            {
                arr[j]=b;
                b=b+2;
            }
            arr[n-1]=(b)+(n/2);
            printf("YES\n");
            for(int i=0;i<n;i++)
            {
                printf("%d",arr[i]);
                printf(" ");
            }
            printf("\n");
        }
    }

}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
int n,len,even_number[10000000];
int main()
{
    scanf("%d",&n);
    while(n--)
    {
        scanf("%d",&len);
        if((len/2)%2!=0)
            printf("NO");
        else
        {
            printf("YES\n");
            for(int i=0,j=2;i<len/2;i++)
            {
                even_number[i]=j;
                printf("%d ",even_number[i]);
                j +=4;
            }
            for(int i=0;i<len/2;)
            {
                printf("%d ",even_number[i]-1);
                i++;
                printf("%d ",even_number[i]+1);
                i++;
            }
        }
        printf("\n");
    }
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
int n,len,even_number[10000];
int main()
{
    scanf("%d",&n);
    while(n--)
    {
        scanf("%d",&len);
        if((len/2)%2!=0)
            printf("NO");
        else
        {
            printf("YES\n");
            for(int i=0,j=2;i<len/2;i++)
            {
                even_number[i]=j;
                printf("%d ",even_number[i]);
                j +=2;
            }
            for(int i=0;i<len/2;)
            {
                printf("%d ",even_number[i]-1);
                i++;
                printf("%d ",even_number[i]+1);
                i++;
            }
        }
        printf("\n");
    }
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
int n,len,even_number[10000];
int main()
{
    scanf("%d",&n);
    while(n--)
    {
        scanf("%d",&len);
        if((len/2)%2!=0)
            printf("NO");
        else
        {
            printf("YES\n");
            for(int i=0,j=2;i<len/2;i++)
            {
                even_number[i]=j;
                printf("%d ",even_number[i]);
                j +=4;
            }
            for(int i=0;i<len/2;)
            {
                printf("%d ",even_number[i]-1);
                i++;
                printf("%d ",even_number[i]+1);
                i++;
            }
        }
        printf("\n");
    }
}


#include<stdio.h>
int main()
{
      long long int t,n,i,s=0,c=0;
      scanf("%lld",&t);
      while(t--){
              scanf("%lld",&n);
              if(n%4==0) printf("NO\n");
              else{
                    printf("YES\n");
                    for(i=2;i<=n;i+=2){
                          printf("%lld ",i);
                          s+=i;
                    }
                    for(i=1;i<n-1;i+=2){
                          printf("%lld ",i);
                          c+=i;
                    }
                    printf("%lld\n", s-c);
              }
              c=0;s=0;
      }
}


#include<stdio.h>
int main()
{
      long long int t,n,i,s=0,c=0;
      scanf("%lld",&t);
      while(t--){
              scanf("%lld",&n);
              if(n%4!=0) printf("NO\n");
              else{
                    printf("YES\n");
                    for(i=2;i<=n;i+=2){
                          printf("%lld ",i);
                          s+=i;
                    }
                    for(i=1;i<n-1;i+=2){
                          printf("%lld ",i);
                          c+=i;
                    }
                    printf("%lld\n", s-c);
              }
              c=0;s=0;
      }
}


#include<stdio.h>
int main()
{
	long int t, n, k, sum;
	scanf("%ld", &t);
	while(t--)
	{
		scanf("%ld", &n);
		n=n/2;
		if(n%2==1)
		{
			printf("NO\n");
			continue;
		}
		else
		{
			printf("YES\n");
			for(k=1;k<=n;k++)
			{
				printf("%ld ", (2*k));
			}

			for(k=1;k<n;k++)
			{
				printf("%ld ", (2*k-1));
			}
			printf("%ld \n", (2*k)+n-1);
		}

	}
}


#include<stdio.h>
int main()
{
	long int t, n, k, sum;
	scanf("%ld", &t);
	while(t--)
	{
		scanf("%ld", &n);
		n=n/2;
		if(n%2==1)
		{
			printf("NO\n");
			continue;
		}
		else
		{
			printf("YES\n");
			for(k=1;k<=n;k++)
			{
				printf("%ld ", (2*k));
			}

			for(k=1;k<n;k++)
			{
				printf("%ld ", (2*k-1));
			}
			printf("%ld", (2*k)+n-1);
		}

	}
}


#include<stdio.h>
#include<stdlib.h>

int main(void)
{
    int t, n;

    scanf("%d", &t);

    while(t--)
    {
        scanf("%d", &n);
        if((n/2)%2 != 0)
        {
            printf("NO\n");
            continue;
        }
        else
        {
            int *a = (int *)malloc(n*sizeof(int));
            a[0] = 2;
            a[n/2] = 1;

            int sum=0;
            sum += 1;
            for(int i=1;i<n/2-1;i++)
            {
                a[i] = a[i-1] + 2;
                a[n/2+i] = a[n/2 + i - 1] + 2;
                sum += a[i] - a[n/2+i];
            }

            a[n/2-1] = a[n/2 - 2] + 2;
            a[n-1] = sum + a[n/2-1];

            printf("YES\n");
            for(int i=0;i<n;i++)
                printf("%d ", a[i]);
            printf("\n");
        }
    }

    return 0;
}


#include <stdio.h>
#include <stdlib.h>

int *create_array(int n)
{
    int *a;

    return a = malloc(sizeof(int) * n);
}

void destroy_array(int *a)
{
    if (a == NULL)
      return;

    free(a);
}

void print_array(int *a, int n)
{
    int i;

    for (i = 0; i < n; i++)
      printf("%d ", a[i]);

    printf("\n");
}

void next_odd(int *a, int n)
{
    // calculate the next successive odd number at the final index
    a[n-1] = a[n-1] + 2;
}

int sum_of_array(int *a, int n, int index)
{
    int i, sum = 0;

    if (index == 0)
    {
        for (i = index; i < n / 2; i++)
          sum += a[i];
    }
    else // case where we start after the midpoint
      for (i = index; i < n; i++)
        sum += a[i];

    return sum;
}

int is_balanced(int *a, int n)
{
    int sum1, sum2;

    // get sum of left side
    sum1 = sum_of_array(a, n, 0);

    // get sum of right side
    sum2 = sum_of_array(a, n, n / 2);

    // check if balanced
    if (sum1 == sum2)
      return 1;
    else if (sum1 < sum2)
      return 2;
    else
      return 0;
}

void fill_array(int *a, int n)
{
    int i, x = 0;

    // fill left side with even numbers (2*i)
    for (i = 0; i < n / 2; i++)
      a[i] = 2 * (i + 1);

    // fill right side with odd numbers (2*x) + 1
    for (i = n / 2; i < n; i++)
    {
        a[i] = 2 * (x) + 1;
        x++;
    }
}

int main(void)
{
    int t, i, *a, n, flag;
    // scan for int t (number of test cases)
    scanf("%d", &t);

    // read each of the t amount of test cases
    for (i = 0; i < t; i++)
    {
        // obtain next int n (assumed to be an even input as per competition guidelines)
        scanf("%d", &n);

        // if n/2 is odd then the left side of the array will never have an even sum
        if ((n / 2) % 2 != 0)
        {
            printf("NO\n");
            continue;
        }

        a = create_array(n);

        // fill the array
        fill_array(a, n); //problem is here

        // check if balnced
        flag = is_balanced(a, n);

        while (flag == 0)
        {
            // calculate new odd at end of the array
            next_odd(a, n);

            // recheck
            flag = is_balanced(a, n);
        }

        // determine if there is a balanced or no balanced array
        if (flag == 1)
        {
            printf("YES\n");
            print_array(a, n);
            destroy_array(a); // clean up
            continue;
        }
        else
        {
            printf("NO\n");
            destroy_array(a); // clean up
            continue;
        }
    }

    return 0;
}


#include <stdio.h>
#include <stdlib.h>

int *create_array(int n)
{
    int *a;

    return a = malloc(sizeof(int) * n);
}

void fill_array(int *a, int n)
{
    int i, x = 0;

    // fill left side with even numbers (2*i)
    for (i = 0; i < n / 2; i++)
      a[i] = 2 * (i + 1);

    // fill right side with odd numbers (2*x) + 1
    for (i = n / 2; i < n; i++)
    {
        a[i] = 2 * x + 1;
        x++;
    }
}

void destroy_array(int *a)
{
    if (a == NULL)
      return;

    free(a);
}

void print_array(int *a, int n)
{
    int i;

    for (i = 0; i < n; i++)
      printf("%d ", a[i]);

    printf("\n");
}

void next_odd(int *a, int n)
{
    // calculate next successive odd number at the final index
    a[n-1] = a[n-1] + 2;
}

int is_balanced(int sum1, int sum2)
{
    // check if balanced
    if (sum1 == sum2)
      return 1;
    else if (sum1 < sum2)
      return 2;
    else
      return 0;
}

int main(void)
{
    int t, i, *a, n, flag, sum1, sum2;

    // scan for int t (number of test cases)
    scanf("%d", &t);

    // read each of the t amount of test cases
    for (i = 0; i < t; i++)
    {
        // obtain next int n (assumed even)
        scanf("%d", &n);

        // if n/2 is odd then the left side of the array will never have an even sum
        if ((n / 2) % 2 != 0)
        {
            printf("NO\n");
            continue;
        }

        a = create_array(n);

        // fill the array
        fill_array(a, n);

        // NOTE: I used the closed forms for the sums of even and odd numbers for order 1 sums
        // get sum of left side
        sum1 = (n / 2) * (n / 2) + (n / 2);

        // get sum of right side
        sum2 = ((n / 2) - 1) * ((n / 2) - 1) + (2 * ((n / 2) - 1)) + 1;

        // check if balanced
        flag = is_balanced(sum1, sum2);

        while (flag == 0)
        {
            // updates the last indice of the array
            next_odd(a, n);

            // calculates the next odd
            sum2 += 2;

            // recheck the sums
            flag = is_balanced(sum1, sum2);
        }

        // determine if there is a balanced or non-balanced array
        if (flag == 1)
        {
            printf("YES\n");
            print_array(a, n);
            destroy_array(a); // clean up
            continue;
        }
        else
        {
            printf("NO\n");
            destroy_array(a); // clean up
            continue;
        }
    }

    return 0;
}


#include <stdio.h>
#include<math.h>

int main(void) {
int t;
scanf("%d",&t);
while(t--)
{
    int n,sum=0,num=0;
    scanf("%d",&n);
    if(n%4!=0)
    {
     printf("NO\n");
    }
    else
    {
     printf("YES\n");
     for(int i=1;i<(n/2)+1;i++)
     {
      int x=2*i;
      sum=sum+x;
      printf("%d ",2*i);
     }
     for(int i=1;i<(n/2);i++)
     {
      int h=2*i-1;
      num=num+h;
      printf("%d ",(2*i-1));
     }
     printf("%d",(sum-num));
     printf("\n");
    }

}
	return 0;
}


#include <stdio.h>
#include<math.h>

int main(void) {
int t;
scanf("%d",&t);
while(t--)
{
    int n,sum=0,num=0;
    scanf("%d",&n);
    if(n%4!=0)
    {
     printf("N0\n");
    }
    else
    {
     printf("YES\n");
     for(int i=1;i<(n/2)+1;i++)
     {
      int x=2*i;
      sum=sum+x;
      printf("%d ",2*i);
     }
     for(int i=1;i<(n/2);i++)
     {
      int h=2*i-1;
      num=num+h;
      printf("%d ",(2*i-1));
     }
     printf("%d",(sum-num));
     printf("\n");
    }

}
	return 0;
}


#include <stdio.h>
#include<math.h>

int main(void) {
int t;
scanf("%d",&t);
while(t--)
{
    int n;
    scanf("%d",&n);
    if(n%4!=0)
    {
     printf("N0\n");
    }
    else
    {
     printf("YES\n");
     for(int i=1;i<(n/2)+1;i++)
     {
      printf("%d ",2*i);
     }
     for(int i=1;i<(n/2)+1;i++)
     {
      printf("%d ",(2*i-1));
     }
     printf("\n");
    }

}
	return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int t,a;
    scanf("%d",&t);
    while(t--)
    {
        int n,i;
        scanf("%d",&n);

        if((n/2)%2==0)
        {
            printf("YES\n");
            for(i=1;i<=n/2;i++)
                printf("%d ",i*2);
            for(i=0;i<(n/2)-1;i++)
            printf("%d ",2*i+1);
             for(i=3;i<=3;i++)

            printf("%d\n",2*(i)+1+(n/2));

        }
        else printf("NO\n");
    }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int t,a;
    scanf("%d",&t);
    while(t--)
    {
        int n,i;
        scanf("%d",&n);

        if((n/2)%2==0)
        {
            printf("YES\n");
            for(i=1;i<=n/2;i++)
                printf("%d ",i*2);
            for(i=0;i<(n/2)-1;i++)
            printf("%d ",2*i+1);

            printf("%d\n",2*(i)+1+(n/2));

        }
        else printf("NO\n");
    }
    return 0;
}


#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
long long int a[100000];
long long int b[100000];
int main()
{
   int t,n,i,j,q;
   a[0]=2;
   b[0]=1;
     for(i=1;i<100000;i++ )
  {
  	a[i]=a[i-1]+2;
  	b[i]=b[i-1]+2;
  }
   scanf("%d",&n);

   for(q=0;q<n;q++)
   {
   	scanf("%d",&t);
   	t=t/2;
   	if(t%2==1)
   	printf("NO\n");
    else
    {
    	printf("YES\n");
        for(i=0;i<t;i++)
		{
			printf("%d ",a[i]);
			}
			for(i=0;i<t-1;i++)
		{
			printf("%d ",b[i]);
			}
			printf("%d\n",b[i]+t);
    }
   }
   return 0;
}


#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
long long int a[100000];
long long int b[100000];
int main()
{
   int t,n,i,j,q;
   a[0]=2;
   b[0]=1;

   scanf("%d",&n);
    for(i=1;i<100000/n+1;i++ )
  {
  	a[i]=a[i-1]+2;
  	b[i]=b[i-1]+2;
  }
   for(q=0;q<n;q++)
   {
   	scanf("%d",&t);
   	t=t/2;
   	if(t%2==1)
   	printf("NO\n");
    else
    {
    	printf("YES\n");
    	int s=0;
        for(i=0;i<t;i++)
		{
			printf("%d ",a[i]);
			s=s+a[i];
			}
			for(i=0;i<t-1;i++)
		{
			printf("%d ",b[i]);
			s=s-b[i];
			}
			printf("%d\n",s);
    }
   }
   return 0;
}


#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
long long int a[10000];
long long int b[10000];
int main()
{
   int t,n,i,j,q;
   a[0]=2;
   b[0]=1;
  for(i=1;i<10000;i++ )
  {
  	a[i]=a[i-1]+2;
  	b[i]=b[i-1]+2;
  }
   scanf("%d",&n);
   for(q=0;q<n;q++)
   {
   	scanf("%d",&t);
   	t=t/2;
   	if(t%2==1)
   	printf("NO\n");
    else
    {
    	printf("YES\n");
    	int s=0;
        for(i=0;i<t;i++)
		{
			printf("%d ",a[i]);
			s=s+a[i];
			}
			for(i=0;i<t-1;i++)
		{
			printf("%d ",b[i]);
			s=s-b[i];
			}
			printf("%d\n",s);
    }
   }
   return 0;
}


#include<stdio.h>
#include<math.h>
int main()
{
    int a,b,c,d=0,e=0,i;
    scanf("%d",&a);
    while(a>0)
    {
        scanf("%d",&b);
        c=b;
        b=b/2;
      if(b%2==1)
      {
          printf("NO\n");
          continue;
      }
      else{
        for(i=1;i<=b;i++)
        {
            printf("%d ",2*i);
            d=d+2*i;
        }
        for(i=1;i<=b-1;i++)
        {
            printf("%d ",2*i-1);
            e=e+(2*i-1);
        }
        printf("%d\n",d-e);
      }
        a--;
    }
    return 0;
}


#include<stdio.h>
#include<math.h>
int main()
{
    int a,b,c,d=0,e=0,i;
    scanf("%d",&a);
    while(a>0)
    {
        scanf("%d",&b);
        c=b;
        b=b/2;
      if(b%2==1)
      {
          printf("NO\n");
          continue;
      }

      else{
             printf("YES\n");
        for(i=1;i<=b;i++)
        {
            printf("%d ",2*i);
            d=d+2*i;
        }
        for(i=1;i<=b-1;i++)
        {
            printf("%d ",2*i-1);
            e=e+(2*i-1);
        }
        printf("%d\n",d-e);
      d=0;
      e=0;
      }
        a--;
    }
    return 0;
}


#include<stdio.h>
#include<math.h>
int main()
{
    int a,b,c,d=0,e=0,i;
    scanf("%d",&a);
    while(a>0)
    {
        scanf("%d",&b);
        c=b;
        b=b/2;
      if(b%2==1)
      {
          printf("NO\n");
          continue;
      }

      else{
             printf("YES\n");
        for(i=1;i<=b;i++)
        {
            printf("%d ",2*i);
            d=d+2*i;
        }
        for(i=1;i<=b-1;i++)
        {
            printf("%d ",2*i-1);
            e=e+(2*i-1);
        }
        printf("%d\n",d-e);
      }
        a--;
    }
    return 0;
}


#include<stdio.h>
#include<math.h>
int main()
{
    int a,b,c,d=0,e=0,i;
    scanf("%d",&a);
    while(a>0)
    {
        scanf("%d",&b);
        c=b;
        b=b/2;
      if(b%2==1)
      {
          printf("NO\n");
          continue;
      }
      printf("YES\n");
      else{
        for(i=1;i<=b;i++)
        {
            printf("%d ",2*i);
            d=d+2*i;
        }
        for(i=1;i<=b-1;i++)
        {
            printf("%d ",2*i-1);
            e=e+(2*i-1);
        }
        printf("%d\n",d-e);
      }
        a--;
    }
    return 0;
}