#include<iostream>
#include<string>
#include<vector>
#include<stdlib.h>
#include<algorithm>

int main()
{
  int k = 0;
  int sum = 0;
  std::string n;
  std::cin >> k; // sum of digits was not less than k
  std::getline(std::cin, n); // number changed to
  std::getline(std::cin, n); // number changed to
  // find the minimum number of digits in which these two can differ
  std::vector<int> v;
  std::priority_queue <int, std::vector<int>, std::greater<int> > pq;
  for (auto c : n){
    const char* ch = new char(c);
    int i = std::atoi(ch);
    v.push_back(i);
    pq.push(i);
    sum += i;
  }
  int count = 0;
  if (sum > k){
    std::cout << 0 << std::endl;
    return 0;
  }
  else{ // tricky
   // first attempt: start replacing the greatest digit w/9
   //  as soon as your sum is greater than k, you're done.
   do{
     sum = 0;
     int min = pq.top();
     pq.pop();
     pq.push(9);
     for(unsigned int q = 0; q < v.size(); ++q){
       if (v[q] == min){
         v[q] = 9;
         break;
       }
     }
     for (auto i : v){
       sum += i;
     }
//     std::cout << sum;
//     std::cout << std::endl;
     ++count;
   }while(sum < k);
   std::cout << count << std::endl;
  }
  return 0;
}


// Create your own template by modifying this file!
#include <bits/stdc++.h>
#include<iostream>
#include<string>
#include<deque>

int main()
{
  int sum = 0;
  std::string ks;
  std::string n;
  std::getline(std::cin, ks); // number changed to
  std::getline(std::cin, n); // number changed to
  // find the minimum number of digits in which these two can differ
  unsigned int k_size = ks.length();
//  for(auto c : ks){
//    ++k_size;
//  }
  int k = std::stoi(ks);
  std::deque<int> v;
  for (auto c : n){
    const char* ch = new char(c);
    int i = std::atoi(ch);
    v.push_back(i);
    sum += i;
  }
  std::sort(v.begin(), v.end());
  int count = 0;
  if(v.size() > k_size * 9){
    std::cout << k_size << std::endl;
  }
  while(sum < k){
    sum -= v.front();
    v.pop_front();
    sum += 9;
    count += 1;
  }
  std::cout << count << std::endl;

  return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<stdlib.h>
#include<algorithm>

int main()
{
  int k = 0;
  int sum = 0;
  std::string n;
  std::cin >> k; // sum of digits was not less than k
  std::getline(std::cin, n); // number changed to
  std::getline(std::cin, n); // number changed to
  // find the minimum number of digits in which these two can differ
  std::vector<int> v;
  for (auto c : n){
    const char* ch = new char(c);
    int i = std::atoi(ch);
    v.push_back(i);
    sum += i;
  }
  int count = 0;
  if (sum > k){
    std::cout << 0 << std::endl;
    return 0;
  }
  else{ // tricky
   // first attempt: start replacing the greatest digit w/9
   //  as soon as your sum is greater than k, you're done.
   do{
     sum = 0;
     auto m = std::min_element(v.begin(), v.end());
     std::replace(v.begin(), v.end() ,v.at(m - v.begin()), 9);
     for (auto i : v){
       sum += i;
     }
     ++count;
   }while(sum < k);
   std::cout << count << std::endl;
  }
  return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<stdlib.h>
#include<algorithm>

int main()
{
  int k = 0;
  int sum = 0;
  std::string n;
  std::cin >> k; // sum of digits was not less than k
  std::getline(std::cin, n); // number changed to
  std::getline(std::cin, n); // number changed to
  // find the minimum number of digits in which these two can differ
  std::vector<int> v;
  for (auto c : n){
    const char* ch = new char(c);
    int i = std::atoi(ch);
    v.push_back(i);
    sum += i;
  }
  int count = 0;
  if (sum > k){
    std::cout << 0 << std::endl;
    return 0;
  }
  else{ // tricky
   // first attempt: start replacing the greatest digit w/9
   //  as soon as your sum is greater than k, you're done.
   do{
     sum = 0;
     auto m = std::min_element(v.begin(), v.end());
     std::replace(v.begin(), v.end() ,v.at(m - v.begin()), 9);
     for (auto i : v){
       sum += i;
     }
     ++count;
   }while(sum <= k);
   std::cout << count << std::endl;
  }
  return 0;
}


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

int main()
{
  int k = 0;
  int sum = 0;
  std::string n;
  std::cin >> k; // sum of digits was not less than k
  std::getline(std::cin, n); // number changed to
  std::getline(std::cin, n); // number changed to
  // find the minimum number of digits in which these two can differ
  std::vector<int> v;
  std::priority_queue <int, std::vector<int>, std::greater<int> > pq;
  for (auto c : n){
    const char* ch = new char(c);
    int i = std::atoi(ch);
    v.push_back(i);
    pq.push(i);
    sum += i;
  }
  int count = 0;
  if (sum > k){
    std::cout << 0 << std::endl;
    return 0;
  }
  else{ // tricky
   // first attempt: start replacing the greatest digit w/9
   //  as soon as your sum is greater than k, you're done.
   do{
     sum = 0;
     int min = pq.top();
     pq.pop();
     pq.push(9);
     for(unsigned int q = 0; q < v.size(); ++q){
       if (v[q] == min){
         v[q] = 9;
         break;
       }
     }
     for (auto i : v){
       sum += i;
     }
//     std::cout << sum;
//     std::cout << std::endl;
     ++count;
   }while(sum < k);
   std::cout << count << std::endl;
  }
  return 0;
}


// Create your own template by modifying this file!
#include <bits/stdc++.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdlib.h>
#include<algorithm>

#ifdef DEBUG
     #define debug(args...)            {dbg,args; cerr<<endl;}
#else
    #define debug(args...)              // Just strip off all debug tokens
#endif

struct debugger
{
    template<typename T> debugger& operator , (const T& v)
    {
        std::cerr<<v<<" ";
        return *this;
    }
} dbg;

int main()
{
  int k = 0;
  int sum = 0;
  std::string n;
  std::cin >> k; // sum of digits was not less than k
  std::getline(std::cin, n); // number changed to
  std::getline(std::cin, n); // number changed to
  // find the minimum number of digits in which these two can differ
  std::vector<int> v;
  for (auto c : n){
    const char* ch = new char(c);
    int i = std::atoi(ch);
    v.push_back(i);
    sum += i;
  }
  int count = 0;
  if (sum > k){
    std::cout << 0 << std::endl;
    return 0;
  }
  else{ // tricky
   // first attempt: start replacing the greatest digit w/9
   //  as soon as your sum is greater than k, you're done.
   do{
     sum = 0;
     v.emplace(v.begin() + count, 9);
     for (auto i : v){
       sum += i;
     }
     ++count;
   }while(sum <= k);
   std::cout << count << std::endl;
  }
  return 0;
}


#include <bits/stdc++.h>
#include<iostream>
#include<string>
#include<deque>

int main()
{
  int sum = 0;
  std::string ks;
  std::string n;
  std::getline(std::cin, ks); // number changed to
  std::getline(std::cin, n); // number changed to
  // find the minimum number of digits in which these two can differ
  unsigned int k_size = ks.length();
//  for(auto c : ks){
//    ++k_size;
//  }
  int k = std::stoi(ks);
  std::deque<int> v;
  for (auto c : n){
    const char* ch = new char(c);
    int i = std::atoi(ch);
    v.push_back(i);
    sum += i;
  }
  std::sort(v.begin(), v.end());
  int count = 0;
  if(v.size() > k_size * 9){
    std::cout << k / 9 << std::endl;
    return 0;
  }
  while(sum < k){
    sum -= v.front();
    v.pop_front();
    sum += 9;
    count += 1;
  }
  std::cout << count << std::endl;

  return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
  ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    long n;
    cin>>n;
    string s;
    cin>>s;
    sort(s.begin(),s.end());
    int l=s.length();
    long sum=0;
    for(int i=0;i<l;i++)
    {
        sum+=(long)s[i]-48;
    }
    if(sum>n)
    {
    cout<<"0";
    }
    else{
        long countm=0;
        for(int i=0;i<l;i++)
        {
            if((s[i]-48)!=9)
           {

           sum=sum-((long)s[i]-48)+9;
            countm+=1;
          if(sum>n)
          {
              break;
          }
           }

        }
        cout<<countm;
    }

return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
  ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    long n;
    cin>>n;
    string s;
    cin>>s;
    int l=s.length();
    long sum=0;
    for(int i=0;i<l;i++)
    {
        sum+=(long)s[i]-48;
    }
    if(sum>n)
    {
    cout<<"0";
    }
    else{
        long countm=0;
        for(int i=s.length()-1;i>=0;i--)
        {
            sum=sum-((long)s[i]-48)+9;
            countm+=1;
          if(sum>n)
          {
              break;
          }

        }
        cout<<countm;
    }

return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
  ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    long n;
    cin>>n;
    string s;
    cin>>s;
    int l=s.length();
    long sum=0;
    for(int i=0;i<l;i++)
    {
        sum+=(long)s[i]-48;
    }
    if(sum>n)
    {
    cout<<"0";
    }
    else{
        long countm=0;
        for(int i=s.length()-1;i>=0;i--)
        {
            if((s[i]-48)!=9)
           {

           sum=sum-((long)s[i]-48)+9;
            countm+=1;
          if(sum>n)
          {
              break;
          }
           }

        }
        cout<<countm;
    }

return 0;
}


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

    lli k;
    cin>>k;
    string str;
    cin>>str;
    int n=str.length();
    vector<int> arr;
    lli sum=0;

    for(int i=0;i<n;i++)
    {
       int val=(int)(str[i]-'0');
       sum+=val;
       arr.push_back(val);
    }
    lli rem=k-sum;
    sort(arr.rbegin(),arr.rend());

    int ans=0;
    int cnt=0;
    while(rem>0)
    {
        ans++;
        rem-=arr[cnt++];

    }
    cout<<ans;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
  ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    long n;
    cin>>n;
    string s;
    cin>>s;
    sort(s.begin(),s.end());
    int l=s.length();
    long sum=0;
    for(int i=0;i<l;i++)
    {
        sum+=(long)s[i]-48;
    }
    if(sum>n)
    {
    cout<<"0";
    }
    else{
        long countm=0;
        for(int i=0;i<l;i++)
        {

           sum=sum-((long)s[i]-48)+9;
            countm+=1;
          if(sum>n)
          {
              break;
          }

        }
        cout<<countm;
    }

return 0;
}


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

    lli k;
    cin>>k;
    string str;
    cin>>str;
    int n=str.length();
    vector<int> arr;
    lli sum=0;

    for(int i=0;i<n;i++)
    {
       int val=(int)(str[i]-'0');
       sum+=val;
       arr.push_back(9-val);
    }

    lli rem=k-sum;
    sort(arr.rbegin(),arr.rend());

    int ans=0;
    int cnt=0;
    while(rem>0)
    {
        ans++;
        rem-=arr[cnt++];

    }
    cout<<ans;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int k ,r ,cnt=0;
    cin>>k;
    string n;
    cin>>n;
    sort(n.begin(),n.end());
    long long int sum=0;
    for(int i=0;i<n.length();i++)
    {
        sum+=(n[i]-48);
    }
    int p=sum;
    for(int i=0;i<n.length();i++)
    {
        sum-=(n[i]-48);
        sum+=9;
        if(sum<k)
        {
            cnt++;
        }
        else
        {
            cnt++;
            break;
        }
    }
    if(p>k)cnt=0;
    cout<<cnt<<endl;

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int k ,r ,cnt=0;
    cin>>k;
    string n;
    cin>>n;
    sort(n.begin(),n.end());
    long long int sum=0;
    for(int i=0;i<n.length();i++)
    {
        sum+=(n[i]-48);
    }
    for(int i=0;i<n.length();i++)
    {
        sum-=(n[i]-48);
        sum+=9;
        if(sum<k)
        {
            cnt++;
        }
        else
        {
            cnt++;
            break;
        }
    }
    cout<<cnt<<endl;

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,k ,r;
    cin>>k>>n;
    long long int sum=0;
    int cnt1=0;
    while(n>0)
    {
        r=n%10;
        n/=10;
        sum+=r;
        cnt1++;
    }
    //cout<<sum<<endl;
    long long int diff=k-sum;
    long long int cnt=0;
    while(diff>0)
    {
        diff/=9;
        cnt++;
    }
    if(cnt>cnt1)cnt=0;
    cout<<cnt<<endl;

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int k ,r ,cnt=0;
    cin>>k;
    string n;
    cin>>n;
    sort(n.begin(),n.end());
    long long int sum=0;
    for(int i=0;i<n.length();i++)
    {
        sum+=(n[i]-48);
    }
    int p=sum;
    for(int i=0;i<n.length();i++)
    {
        sum-=(n[i]-48);
        sum+=9;
        if(sum<k)
        {
            cnt++;
        }
        else
        {
            cnt++;
            break;
        }
    }
    if(p>=k)cnt=0;
    cout<<cnt<<endl;

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,k ,r;
    cin>>k>>n;
    long long int sum=0;
    while(n>0)
    {
        r=n%10;
        n/=10;
        sum+=r;
    }
    //cout<<sum<<endl;
    long long int diff=k-sum;
    long long int cnt=0;
    while(diff>0)
    {
        diff/=9;
        cnt++;
    }
    cout<<cnt<<endl;

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int k ,r;
    cin>>k;
    string n;
    cin>>n;
    long long int sum=0;
    for(int i=0;i<n.length();i++)
    {
        sum+=(n[i]-48);
    }
    //cout<<sum<<endl;
    long long int diff=k-sum;
    long long int cnt=0;
    while(diff>0)
    {
        diff/=10;
        cnt++;
    }
    cout<<cnt<<endl;

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,k ,r;
    cin>>k>>n;
    long long int sum=0;
    while(n>0)
    {
        r=n%10;
        n/=10;
        sum+=r;
    }
    //cout<<sum<<endl;
    long long int diff=k-sum;
    long long int cnt=0;
    while(diff>0)
    {
        diff/=10;
        cnt++;
    }
    cout<<cnt<<endl;

}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
vector<int> v;
int main() {
	long long int sum=0,k;
	cin>>k;
	string s;
	cin>>s;
	for (int i=0;i<s.size();i++){
		char ch=s[i];
		int m=ch-48;
		sum=sum+m;
		v.pb(9-m);
	}
//	cout<<sum<<endl;

	if (k<=sum){
		cout<<"0"<<endl;
	}
	else {
		int sum1=0;
		for (int y=0;y<v.size();y++){
			sum1=sum1 + v[y];
			if (sum1>=k){
				cout<<y+1<<endl;
				break;
			}
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
vector<int> v;
int main() {
	long long int sum=0,k;
	cin>>k;
	string s;
	cin>>s;
	for (int i=0;i<s.size();i++){
		char ch=s[i];
		int m=ch-48;
		sum=sum+m;
		v.pb(9-m);
	}
	//cout<<sum<<endl;
	sort(v.begin(),v.end());
	if (k<=sum){
		//cout<<"0"<<endl;
		int y=v.size()-1;
		int o=0;
		while (v[y]==9){
		y--;
		o++;
		}
		cout<<o<<endl;
	}
	else {
		int sum1=0;
		int y=v.size()-1;
		int o=0;
		for (y=v.size()-1;y>=0;y--){
			sum1=sum1 + v[y];
			o++;
			if (sum1>=k){
			//	cout<<o<<endl;
				break;
			}
		}
		y--;
		while (v[y]==9){
		y--;
		o++;
		}
		cout<<o<<endl;

	}
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	long long int k,n;
	cin>>k;
	cin>>n;
	long long int sum=0;
	int arr[10];
	for (int i=0;i<10;i++){
		arr[i]=0;
	}
	while(n!=0){
		int digit = n%10;
		arr[digit]++;
		n=n/10;
		sum = sum + digit;
	}
	int ans = 0;
	if (sum>=k){
		cout<<ans<<endl;
	}else{
	int diff=k-sum;
	int check=diff;
	int counter=0;
	for (int i=0;i<10;i++){
		for (int j=1;j<=arr[i];j++){
		check = (check - (9-i));
		counter++;
		if (check<=0){
		cout<<counter<<endl;

		return 0 ;
		}}}

	}
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	long long int k,n;
	cin>>k;
	cin>>n;
	long long int sum=0;
	int arr[10];
	for (int i=0;i<n;i++){
		arr[i]=0;
	}
	while(n!=0){
		int digit = n%10;
		arr[digit]++;
		n=n/10;
		sum = sum + digit;
	}
	int ans = 0;
	if (sum>=k){
		cout<<ans<<endl;
	}else{
	int diff=k-sum;
	int check=diff;
	int counter=0;
	for (int i=0;i<10;i++){
		for (int j=1;j<=arr[i];j++){
		check = (check - (9-i));
		counter++;
		if (check<=0){
		cout<<counter<<endl;

		return 0 ;
		}}}

	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define f first
#define s second
vector<pair<int,int>> v;
int main() {
	long long int sum=0,k;
	cin>>k;
	string s;
	cin>>s;
	int l=0;
	for (int i=0;i<s.size();i++){
		char ch=s[i];
		int m=ch-48;
		if (m==0 && l==0)
		v.pb({9-m,1});
		else{
			l=1;
			v.pb({9-m,0});
		}
		sum=sum+m;
	}
	//cout<<sum<<endl;
	sort(v.begin(),v.end());
	/*for (int i=0;i<v.size();i++){
		cout<<v[i]<<" ";
	}
	cout<<endl;
	*/
	if (k<=sum){
		//cout<<"0"<<endl;
		int y=v.size()-1;
		int o=0;
		while (v[y].f==9 && v[y].s==1){
		y--;
		o++;
		}
		cout<<o<<endl;
	}
	else {
		int sum1=sum;
		int y=v.size()-1;
		int o=0;
		for (y=v.size()-1;y>=0;y--){
			sum1=sum1 + v[y].f;
			o++;
			if (sum1>=k){
			//	cout<<o<<endl;
				break;
			}
		}
		y--;
		while (v[y].f==9 && v[y].s==1){
		y--;
		o++;
		}
		cout<<o<<endl;

	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define f first
#define s second
vector<pair<int,int>> v;
int main() {
	long long int sum=0,k;
	cin>>k;
	string s;
	cin>>s;
	int l=0;
	for (int i=0;i<s.size();i++){
		char ch=s[i];
		int m=ch-48;
		if (m==0 && l==0)
		v.pb({9-m,1});
		else{
			l=1;
			v.pb({9-m,0});
		}
		sum=sum+m;
	}
	//cout<<sum<<endl;
	sort(v.begin(),v.end());
	/*for (int i=0;i<v.size();i++){
		cout<<v[i]<<" ";
	}
	cout<<endl;
	*/
	if (k<=sum){
		//cout<<"0"<<endl;
		int y=v.size()-1;
		int o=0;
		while (v[y].f==9 && v[y].s==1){
		y--;
		o++;
		}
		cout<<o<<endl;
	}
	else {
		int sum1=0;
		int y=v.size()-1;
		int o=0;
		for (y=v.size()-1;y>=0;y--){
			sum1=sum1 + v[y].f;
			o++;
			if (sum1>=k){
			//	cout<<o<<endl;
				break;
			}
		}
		y--;
		while (v[y].f==9 && v[y].s==1){
		y--;
		o++;
		}
		cout<<o<<endl;

	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
vector<int> v;
int main() {
	long long int sum=0,k;
	cin>>k;
	string s;
	cin>>s;
	for (int i=0;i<s.size();i++){
		char ch=s[i];
		int m=ch-48;
		sum=sum+m;
		v.pb(9-m);
	}
	//cout<<sum<<endl;

	if (k<=sum){
		cout<<"0"<<endl;
	}
	else {
		int sum1=0;
		sort(v.begin(),v.end());
		int o=0;
		for (int y=v.size()-1;y>=0;y--){
			sum1=sum1 + v[y];
			o++;
			if (sum1>=k){
				cout<<o<<endl;
				break;
			}
		}
	}
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	long long int k,n;
	cin>>k;
	cin>>n;
	long long int sum=0;
	int arr[10];
	for (int i=0;i<n;i++){
		arr[i]=0;
	}
	while(n!=0){
		int digit = n%10;
		arr[digit]++;
		n=n/10;
		sum = sum + digit;
	}
	int ans = 0;
	if (sum>=k){
		cout<<ans<<endl;
	}else{
	int diff=k-sum;
	int check=diff;
	int counter=0;
	for (int i=0;i<10;i++){
		for (int j=1;j<=arr[i];j++){
		check = (check - (9-i));
		counter++;
		if (check<=0)
		break;
	}}
	cout<<counter<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
vector<int> v;
int main() {
	long long int sum=0,k;
	cin>>k;
	string s;
	cin>>s;
	for (int i=0;i<s.size();i++){
		char ch=s[i];
		int m=ch-48;
		sum=sum+m;
		v.pb(9-m);
	}
//	cout<<sum<<endl;

	if (k<=sum){
		cout<<"0"<<endl;
	}
	else {
		int sum1=0;
		sort(v.begin(),v.end());
		for (int y=0;y<v.size();y++){
			sum1=sum1 + v[y];
			if (sum1>=k){
				cout<<y+1<<endl;
				break;
			}
		}
	}
	return 0;
}


#include <bits/stdc++.h> //JuniorMonster a.k.a Sho10
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define mod 1000000007
#define PI 3.14159265359
using namespace std;
ll k,n;
string s;
int32_t main(){
cin>>k;
cin>>s;
n=s.size();
ll s1=0;
for(ll i=0;i<n;i++)
    s1=s1+s[i]-'0';
if(s1>=k){
    rc(0);
}
ll ans=0;
sort(s.begin(),s.end());
ll i=0;
k=k-s1;
while(k>0&&i<n){
    ans++;
    i++;
    k=k-'9'+s[i];
}
cout<<ans;
return 0;}


#include <bits/stdc++.h> //JuniorMonster a.k.a Sho10
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define mod 1000000007
#define PI 3.14159265359
using namespace std;
ll k,n;
string s;
int32_t main(){
cin>>k;
cin>>s;
n=s.size();
ll s1=0;
for(ll i=0;i<n;i++)
    s1=s1+s[i]-'0';
if(s1>=k){
    rc(0);
}
ll ans=0;
sort(s.begin(),s.end());
ll i=0;
k=k-s1;
while(k>0&&i<=n-1){
        if(s[i]=='9') break;
    ans++;
    i++;
    k=k-'9'+s[i];
}
cout<<ans;
return 0;}


#include <bits/stdc++.h> //JuniorMonster a.k.a Sho10
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define mod 1000000007
#define PI 3.14159265359
using namespace std;
ll k,n;
string s;
int32_t main(){
cin>>k;
cin>>s;
n=s.size();
ll s1=0;
for(ll i=0;i<n;i++)
    s1=s1+s[i]-'0';
if(s1>=k){
    rc(0);
}
ll ans=0;
sort(s.begin(),s.end());
ll i=0;
k=k-s1-1;
while(k>0&&i<n){
    if(s[i]!='9'){
    ans++;
        }
    i++;
    k=k-'9'+s[i];
}
cout<<ans;
return 0;}


#include <bits/stdc++.h> //JuniorMonster a.k.a Sho10
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define mod 1000000007
#define PI 3.14159265359
using namespace std;
ll k,n;
string s;
int32_t main(){
cin>>k;
cin>>s;
n=s.size();
ll s1=0;
for(ll i=0;i<n;i++)
    s1=s1+s[i]-'0';
if(s1>=k){
    rc(0);
}
ll ans=0;
sort(s.begin(),s.end());
ll i=0;
k=k-s1;
while(k>0&&i<=n-1){
        if(s[i]=='9') break;
if(k<=0) break;
    ans++;
    i++;
    k=k-'9'+s[i];
}
cout<<ans;
return 0;}


#include <bits/stdc++.h> //JuniorMonster a.k.a Sho10
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define mod 1000000007
#define PI 3.14159265359
using namespace std;
ll k,n;
string s;
int32_t main(){
cin>>k;
cin>>s;
n=s.size();
ll s1=0;
for(ll i=0;i<n;i++)
    s1=s1+s[i]-'0';
if(s1>=k){
    rc(0);
}
ll ans=0;
sort(s.begin(),s.end());
ll i=0;
k=k-s1;
while(k>0&&i<n){
    if(s[i]!='9'){
    ans++;
        }
    i++;
    k=k-'9'+s[i];
}
cout<<ans;
return 0;}


#include <bits/stdc++.h> //JuniorMonster a.k.a Sho10
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define mod 1000000007
#define PI 3.14159265359
using namespace std;
ll k,n;
string s;
int32_t main(){
cin>>k;
cin>>s;
n=s.size();
ll s1=0;
for(ll i=0;i<n;i++)
    s1=s1+s[i]-'0';
if(s1>=k){
    rc(0);
}
ll ans=0;
sort(s.begin(),s.end());
ll i=0;
k=k-s1;
while(k>0&&i<=n-1){
    if(s[i]!='9'){
    ans++;
        }
    i++;
    k=k-'9'+s[i];
}
cout<<ans;
return 0;}


#include <bits/stdc++.h> //JuniorMonster a.k.a Sho10
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define mod 1000000007
#define PI 3.14159265359
using namespace std;
ll k,n;
string s;
int32_t main(){
cin>>k;
cin>>s;
n=s.size();
ll s1=0;
for(ll i=0;i<n;i++)
    s1=s1+s[i]-'0';
if(s1>=k){
    rc(0);
}
ll ans=0;
sort(s.begin(),s.end());
ll i=0;
k=k-s1;
while(k>0&&i<=n-1){
        if(s[i]=='9') break;
if(k<=0) break;
    ans++;
      k=k-'9'+s[i];
    i++;
}
cout<<ans;
return 0;}


#include <bits/stdc++.h> //JuniorMonster a.k.a Sho10
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define mod 1000000007
#define PI 3.14159265359
using namespace std;
ll k,n;
string s;
int32_t main(){
cin>>k;
cin>>s;
n=s.size();
ll s1=0;
for(ll i=0;i<n;i++)
    s1=s1+s[i]-'0';
if(s1>=k){
    rc(0);
}
ll ans=0;
sort(s.begin(),s.end());
ll i=0;
while(k>0&&i<n){
    ans++;
    i++;
    k=k-'9'+s[i];
}
cout<<ans;
return 0;}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <queue>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <list>

using namespace std;

#define ll long long
#define ull unsigned long long

typedef pair<int,int> P;
queue<int> qu;
int INF=999999;

int max1(int a,int b){
	return a>b?a:b;
}
int min1(int a,int b){
	return a>b?b:a;
}
int gcd(int a,int b){
	return b?a:gcd(b,a%b);
}

/*****************************************************************/

int len(int num){
	int ans=0;
	while(num){
		num/=10;
		ans++;
	}
	return ans;
}

int main(){
	/****
	std::ios::sync_with_stdio(false);
	cin.tie(0);
	***/
	int n,m=0;
	char a[1000005];
	scanf("%d",&n);
	cin>>a;
	int k=strlen(a);
	for(int i=0;i<k;i++)
		m+=a[i]-'0';
	if(m>=n){
		printf("0\n");
		return 0;
	}
	k=n-m;
	printf("%d",len(k));
//	printf("%d\n",m);

	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <queue>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <list>

using namespace std;

#define ll long long
#define ull unsigned long long

typedef pair<int,int> P;
queue<int> qu;
int INF=999999;

int max1(int a,int b){
	return a>b?a:b;
}
int min1(int a,int b){
	return a>b?b:a;
}
int gcd(int a,int b){
	return b?a:gcd(b,a%b);
}

/*****************************************************************/

int len(int num){
	int ans=0;
	while(num){
		num/=10;
		ans++;
	}
	return ans;
}

int main(){
	/****
	std::ios::sync_with_stdio(false);
	cin.tie(0);
	***/
	int n,m=0;
	char a[1005];
	scanf("%d",&n);
	cin>>a;
	int k=strlen(a);
	for(int i=0;i<k;i++)
		m+=a[i]-'0';
	if(m>=n){
		printf("0\n");
		return 0;
	}
	k=n-m;
	printf("%d",len(k));
//	printf("%d\n",m);

	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <queue>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <list>

using namespace std;

#define ll long long
#define ull unsigned long long

typedef pair<int,int> P;
queue<int> qu;
int INF=999999;

int max1(int a,int b){
	return a>b?a:b;
}
int min1(int a,int b){
	return a>b?b:a;
}
int gcd(int a,int b){
	return b?a:gcd(b,a%b);
}

/*****************************************************************/
int map[12][101][101];
bool hav[101][101];
int n,q,c;

void init(){
	for(int i=1;i<=100;i++)
	for(int j=1;j<=100;j++){
		map[0][i][j]=0;
		hav[i][j]=false;
	}
}

void Build(){
	for(int h=1;h<=c+1;h++){
		for(int i=1;i<=100;i++)
		{
			for(int j=1;j<=100;j++){
				if(hav[i][j]==true)
				map[h][i][j]=(map[h-1][i][j]+1)%(c+1);
				else
				map[h][i][j]=map[h-1][i][j];
			}
		}

	}
}

int Query(int time_,int x1,int y1,int x2,int y2){
	int h=time_%(c+1);
	int lx,rx,dy,uy;
	lx=x1,dy=y1,rx=x2,uy=y2;
	int sum=0;
	for(int i=lx;i<=rx;i++){
		for(int j=dy;j<=uy;j++){
			sum+=map[h][i][j];
		}
	}
	return sum;
}

int main(){
	/****
	std::ios::sync_with_stdio(false);
	cin.tie(0);
	***/
	init();
	int x,y,z;
	scanf("%d%d%d",&n,&q,&c);
	for(int i=0;i<n;i++){
		scanf("%d%d%d",&x,&y,&z);
		map[0][x][y]+=z;
		hav[x][y]=true;
	}
	Build();
	int time_,x1,y1,x2,y2;
	for(int i=0;i<q;i++){
		scanf("%d%d%d%d%d",&time_,&x1,&y1,&x2,&y2);
		printf("%d\n",Query(time_,x1,y1,x2,y2));
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <queue>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <list>

using namespace std;

#define ll long long
#define ull unsigned long long

typedef pair<int,int> P;
queue<int> qu;
int INF=999999;

int max1(int a,int b){
	return a>b?a:b;
}
int min1(int a,int b){
	return a>b?b:a;
}
int gcd(int a,int b){
	return b?a:gcd(b,a%b);
}

/*****************************************************************/

int len(int num){
	int ans=0;
	while(num){
		num/=10;
		ans++;
	}
	return ans;
}

int main(){
	/****
	std::ios::sync_with_stdio(false);
	cin.tie(0);
	***/
	int n,m=0;
	char a[100005];
	scanf("%d",&n);
	cin>>a;
	int k=strlen(a);
	for(int i=0;i<k;i++)
		m+=a[i]-'0';
	if(m>=n){
		printf("0\n");
		return 0;
	}
	k=n-m;
	printf("%d",k/9+(k%9==0?0:1));
//	printf("%d\n",m);
//	printf("%d\n",len(125138510));
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>

using namespace  std;

int max1(int a,int b){
return a>b?a:b;
}

int main(){
    int k;
    scanf("%d",&k);
    char s[100005];
    scanf("%s",s);

    int ans[100005];
    int m=0;
    int len=strlen(s);
    for(int i=0;i<len;i++){
        m+=s[i]-'0';
        ans[i]=max1(s[i]-'0',9-(s[i]-'0')+1);
    }
    if(m>=k){
        printf("0\n");
        return 0;
    }
    int t =k-m;
    int j=0;
    while(t>0){
        t-=ans[j++];
    }
    printf("%d\n",j);

    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>

using namespace  std;

int max1(int a,int b){
return a>b?a:b;
}
bool bomp(int a,int b){
    return a>b;
}

int main(){
    int k;
    scanf("%d",&k);
    char s[100005];
    scanf("%s",s);

    int ans[100005];
    int m=0;
    int len=strlen(s);
    for(int i=0;i<len;i++){
        //printf("m=%d  ",m);
        m+=(s[i]-'0');
        ans[len-1-i]=(9-(s[i]-'0'));
    }
    //printf("m=%d\n",m);
    sort(ans,ans+len,bomp);
       /*
    for(int i=0;i<len;i++)
    printf("%d",ans[i]);
    printf("\n");  */
    //int t =k-m;
    int j=0;
    while(m<k){
        m+=ans[j++];
    }
    printf("%d\n",j);

    return 0;
}

/**
700
9307216756404590162143344901558545760612901767837570518638460182990196397856220673189163417019781185

32

*/


#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>

using namespace  std;

int max1(int a,int b){
return a>b?a:b;
}

int main(){
    int k;
    scanf("%d",&k);
    char s[100005];
    scanf("%s",s);

    int ans[100005];
    int m=0;
    int len=strlen(s);
    for(int i=0;i<len;i++){
        m+=s[i]-'0';
        ans[i]=max1(s[i]-'0',9-(s[i]-'0'));
    }
    /*
    printf("m=%d\n",m);
    for(int i=0;i<len;i++)
    printf("%d ",ans[i]);
    printf("\n");
                   */
    if(m>=k){
        printf("0\n");
        return 0;
    }
    int t =k-m;
    int j=len-1;
    int num=0;
    while(t>0){
        t-=ans[j--];
        num++;
    }
    printf("%d\n",num);

    return 0;
}

/**
70
3326631213

*/


#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>

using namespace  std;

int max1(int a,int b){
return a>b?a:b;
}
bool bomp(int a,int b){
return a>b;
}

int main(){
    int k;
    scanf("%d",&k);
    char s[100005];
    scanf("%s",s);

    int ans[100005];
    int m=0;
    int len=strlen(s);
    for(int i=0;i<len;i++){
        m+=s[i]-'0';
        ans[len-1-i]=max1(s[i]-'0',9-(s[i]-'0'));
    }
    /*
    printf("m=%d\n",m);
    for(int i=0;i<len;i++)
    printf("%d",ans[i]);
    printf("\n"); */
    sort(ans,ans+len,bomp);
    //int t =k-m;
    int j=0;
    while(m<k){
        m+=ans[j++];
    }
    printf("%d\n",j);

    return 0;
}

/**
70
3326631213

*/


#include<bits/stdc++.h>
#include <iostream>
#define ll long long
using namespace std;

int main() {
	// your code goes here
	ll int k;
	cin >> k;
	string s;
	cin >> s;
	int mx=0;
	int cnt=0;
	for(int i=0;i<s.size();i++)
	{
	    mx=max(mx,s[i]-48);
	    cnt+=(s[i]-48);
	}
	if(cnt>=k)
	cout << "0";
	else
	{
	    int x=k-cnt;
	    int y=x/mx;
	    int z=cnt+y*mx;
	    if(k==z)
	    cout << y;
	    else
	    {
	        cout << y+1;
	    }
	}

	return 0;
}


#include <iostream>
#define ll long long
using namespace std;

int main() {
	// your code goes here
	ll int k;
	cin >> k;
	string s;
	cin >> s;
	ll int mx=0;
	ll int cnt=0;
	for(int i=0;i<s.size();i++)
	{
	    mx=max(mx,s[i]-48);
	    cnt+=(s[i]-48);
	}
	if(cnt>=k)
	cout << "0";
	else
	{
	    ll int x=k-cnt;
	    ll int y=x/mx;
	    ll int z=cnt+y*mx;
	    ll if(k==z)
	    cout << y;
	    else
	    {
	        cout << y+1;
	    }
	}

	return 0;
}


#include<bits/stdc++.h>
#include<string.h>
#include<algorithm>
#include<vector>
#define endl  "\n"
#define ll long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cin.exceptions(cin.failbit);
using namespace std;
int main() {
	// your code goes here
	ll int k;
	cin >> k;
	string s;
	cin >> s;
	ll int mx=0;
	ll int cnt=0;
	for(int i=0;i<s.size();i++)
	{
	 //   mx=max(mx,s[i]-48);
	    cnt+=(s[i]-48);
	}
	if(cnt>=k)
	cout << "0";
	else
	{
	   ll  int x=k-cnt;
	    //cout << x << endl;
	    sort(s.begin(),s.end());
	    ll int cnt1=0;
	    for(int i=0;i<s.size();i++)
	    {

	    	cnt1+=9-(s[i]-48);
	    	if(cnt1>=x)
	    	{
			cout << i+1;
			return 0;
			}
		}

	    //int z=cnt+y*mx;
	}
}


#include<bits/stdc++.h>
#include <iostream>
#define ll long long
using namespace std;

int main() {
	// your code goes here
	ll int k;
	cin >> k;
	string s;
	cin >> s;
	int mx=0;
	int cnt=0;
	for(int i=0;i<s.size();i++)
	{
	    mx=max(mx,s[i]-48);
	    cnt+=(s[i]-48);
	}
	if(cnt>=k)
	cout << "0";
	else
	{
	    int x=k-cnt;
	    int y=x/mx;
	    int z=cnt+y*mx;
	    if(k==z)
	    cout << y;
	    else
	    {
	        int raj=k-z;
	        sort(s.begin(),s.end());
	        for(int i=s.size()-1;i>=0;i--)
	        {
	            if(raj==0)
	            break;
	            if((s[i]-48)!=mx)
	            {
	                y++;
	                raj=raj-(s[i]-48);
	            }
	        }
	        cout << y;
	    }
	}

	return 0;
}


#include<bits/stdc++.h>
#include<string.h>
#include<algorithm>
#include<vector>
#define endl  "\n"
#define ll long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cin.exceptions(cin.failbit);
using namespace std;
int main() {
	// your code goes here
	ll int k;
	cin >> k;
	string s;
	cin >> s;
	ll int mx=0;
	ll int cnt=0;
	for(int i=0;i<s.size();i++)
	{
	 //   mx=max(mx,s[i]-48);
	    cnt+=(s[i]-48);
	}
	if(cnt>=k)
	cout << "0";
	else
	{
	   ll  int x=k-cnt;
	    //cout << x << endl;
	    sort(s.begin(),s.end());
	    ll int cnt1=0;
	    for(int i=0;i<s.size();i++)
	    {

	    	cnt1+=9-(s[i]-48);
	    	if(cnt>=x)
	    	{

			cout << i+1;
			return 0;
			}
		}

	    //int z=cnt+y*mx;
	}
}


#include<bits/stdc++.h>
#include<string.h>
#include<algorithm>
#include<vector>
#define endl  "\n"
#define ll long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cin.exceptions(cin.failbit);
using namespace std;
int main() {
	// your code goes here
	ll int k;
	cin >> k;
	string s;
	cin >> s;
	ll int mx=0;
	ll int cnt=0;
	for(int i=0;i<s.size();i++)
	{
	 //   mx=max(mx,s[i]-48);
	    cnt+=(s[i]-48);
	}
	if(cnt>=k)
	cout << "0";
	else
	{
	   ll  int x=k-cnt;
	    //cout << x << endl;
	    sort(s.begin(),s.end());
	    ll int cnt1=0;
	    for(int i=0;i<s.size();i++)
	    {
	    	if(cnt1>x)
	    	{
	    		cout << i;
	    		break;
			}
			if(cnt1==x)
			{
				cout << i-1;
				break;
			}
	    	cnt1+=9-(s[i]-48);

		}

	    //int z=cnt+y*mx;
	}
}


#include<bits/stdc++.h>
#include<string.h>
#include<algorithm>
#include<vector>
#define endl  "\n"
#define ll long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cin.exceptions(cin.failbit);
using namespace std;
int main() {
	// your code goes here
	ll int k;
	cin >> k;
	string s;
	cin >> s;
	ll int mx=0;
	ll int cnt=0;
	for(int i=0;i<s.size();i++)
	{
	 //   mx=max(mx,s[i]-48);
	    cnt+=(s[i]-48);
	}
	if(cnt>=k)
	cout << "0";
	else
	{
	   ll  int x=k-cnt;
	    //cout << x << endl;
	    sort(s.begin(),s.end());
	    ll int cnt1=0;
	    for(int i=0;i<s.size();i++)
	    {
	    	if(cnt1>=x)
	    	{
	    		cout << i;
	    		break;
			}

	    	cnt1+=9-(s[i]-48);

		}

	    //int z=cnt+y*mx;
	}
}


#include<bits/stdc++.h>
#include <iostream>
#define ll long long
using namespace std;

int main() {
	// your code goes here
	ll int k;
	cin >> k;
	string s;
	cin >> s;
	int mx=0;
	int cnt=0;
	for(int i=0;i<s.size();i++)
	{
	    mx=max(mx,s[i]-48);
	    cnt+=(s[i]-48);
	}
	if(cnt>=k)
	cout << "0";
	else
	{
	    int x=k-cnt;
	    int y=x/mx;
	    int z=cnt+y*mx;
	    if(k==z)
	    cout << y;
	    else
	    {
	        int raj=k-z;
	        sort(s.begin(),s.end());
	        for(int i=s.size()-1;i>=0;i++)
	        {
	            if(raj==0)
	            break;
	            if((s[i]-48)!=mx)
	            {
	                y++;
	                raj=raj-(s[i]-48);
	            }
	        }
	        cout << y;
	    }
	}

	return 0;
}


#include<bits/stdc++.h>
#include<string.h>
#include<vector>
#define endl  "\n"
#define ll long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cin.exceptions(cin.failbit);
using namespace std;
int main() {
	// your code goes here
	ll int k;
	cin >> k;
	string s;
	cin >> s;
	int mx=0;
	int cnt=0;
	for(int i=0;i<s.size();i++)
	{
	 //   mx=max(mx,s[i]-48);
	    cnt+=(s[i]-48);
	}
	if(cnt>=k)
	cout << "0";
	else
	{
	    int x=k-cnt;
	    if(x%9!=0)
	    cout << x/9 + 1;
	    else
	    cout << x/9;
	    //int z=cnt+y*mx;
	}
}


#include<bits/stdc++.h>
#include<string.h>
#include<algorithm>
#include<vector>
#define endl  "\n"
#define ll long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cin.exceptions(cin.failbit);
using namespace std;
int main() {
	// your code goes here
	ll int k;
	cin >> k;
	string s;
	cin >> s;
	int mx=0;
	int cnt=0;
	for(int i=0;i<s.size();i++)
	{
	 //   mx=max(mx,s[i]-48);
	    cnt+=(s[i]-48);
	}
	if(cnt>=k)
	cout << "0";
	else
	{
	    int x=k-cnt;
	    //cout << x << endl;
	    sort(s.begin(),s.end());
	    int cnt1=0;
	    for(int i=0;i<s.size();i++)
	    {
	    	if(cnt1>=x)
	    	{
	    		cout << i;
	    		break;
			}

	    	cnt1+=9-(s[i]-48);

		}

	    //int z=cnt+y*mx;
	}
}


#include <iostream>
#include <vector>
#include <string>
#include <queue>
#define optimizar_io ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
int main(){
    optimizar_io
    string k;
    int n,sum=0,cnt=0;
    cin>>n>>k;
    priority_queue<int, vector<int>, greater<int> >pq;
    for( auto it: k )sum+=( (int)it-'0' ),pq.push((int)it-'0');
    while(sum<n)sum-=pq.top(),sum+=9,pq.pop(),cnt++;
    cout<<cnt<<"\n";
    return 0;
}


#include <bits/stdc++.h>
#define optimizar_io ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
int main (){
    optimizar_io
    long long a,sum=0,joder=0,cont=0;
    string b,aux;
    cin>>a>>b;
    for(long long i=0;i<(long long)b.size();++i)aux=b[i],sum+=atoll(aux.c_str());
    if(sum>=a)cout<<"0\n";
    else {
            joder=a-sum;
            while(joder>0)joder/=10,cont++;
            cout<<cont<<"\n";
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
using namespace std;
int main(){

    string k;
    int n; cin >> n >> k;
    int sum = 0;
    priority_queue<int, vector<int>, greater<int> >pq;
    for( auto it: k ){
        sum+=( (int)it-'0' );
        pq.push((int)it-'0');
    }
    int cnt = 0;
    while( sum < n ){
        sum-=pq.top();
        sum+=9;
        pq.pop();
        cnt++;
    }
    cout << cnt << '\n';

}


#include <bits/stdc++.h>
#define optimizar_io ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
int main (){
    optimizar_io
    bool ban=false;
    long long a,sum=0,joder=0,cont=0;
    string b,aux,g="";
    cin>>a>>b;
    for(long long i=0;i<(long long )b.size();++i){
        if(ban==true)g+=b[i];
        else if(b[i]!='0')g+=b[i],ban=true;
    }
    for(long long i=0;i<(long long)g.size();++i)aux=g[i],sum+=atoll(aux.c_str());
    if(sum>=a)cout<<"0\n";
    else {
            joder=a-sum;
            while(joder>0)joder/=10,cont++;
            cout<<(long long)g.size()-cont<<"\n";
    }
    return 0;
}


#include <bits/stdc++.h>
#define optimizar_io ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
int main (){
    optimizar_io
    long long a,sum=0,cont=0,auxi=0;
    string b,aux;
    cin>>a>>b;
    for(long long i=0;i<(long long )b.size();++i)aux=b[i],sum+=atoll(aux.c_str());
    if(sum>=a){cout<<"0\n";return 0;}
    else {
            for(long long i=0;i<(long long)b.size();++i){
                cont++;
                aux=b[i],auxi=atoll(aux.c_str()),sum-=auxi,sum+=9;
                if(sum>=a){
                        cout<<cont<<"\n";
                        return 0;
                }
            }
    }
}


#include <bits/stdc++.h>
#define optimizar_io ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
int main (){
    optimizar_io
    long long a,sum=0;
    string b,aux;
    cin>>a>>b;
    for(long long i=0;i<(long long)b.size();++i)aux=b[i],sum+=atoll(aux.c_str());
    if(sum>=a)cout<<"0\n";
    else cout<<a-sum<<"\n";
    return 0;
}


#include <bits/stdc++.h>
#define optimizar_io ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
int main (){
    optimizar_io
    bool ban=false;
    long long a,sum=0,cont=0,auxi=0;
    string b,aux,g="";
    cin>>a>>b;
    for(long long i=0;i<(long long )b.size();++i){
        if(ban==true)g+=b[i];
        else if(b[i]!='0')g+=b[i],ban=true;
    }
    for(long long i=0;i<(long long )g.size();++i)aux=g[i],sum+=atoll(aux.c_str());
    if(sum>=a){cout<<"0\n";return 0;}
    else {
            for(long long i=0;i<(long long)g.size();++i){
                cont++;
                aux=g[i],auxi=atoll(aux.c_str()),sum-=auxi,sum+=9;
                if(sum>=a){
                        cout<<cont<<"\n";
                        return 0;
                }
            }
    }
}


#include<iostream>
using namespace std;
int main(){
	int k,a[10];
	cin>>k;
	string t;
	cin>> t;
	for(int i=0;i<t.size();i++){
		a[((int)t[i]-'0')]++;
		k-=(int)t[i]-'0';
	}
	cout<<k;
	/*int ans=0;
	while(k>0){
		ans++;
		for(int i=0;i<9;i++)
			if(a[i]){
				a[i]--;
				k-=9-i;
			}
	}
	cout<<ans;*/
}


#include<iostream>
using namespace std;
int main(){
	int k,a[10];
	cin>>k;
	string t;
	cin>> t;
	for(int i=0;i<t.size();i++){
		a[((int)t[i]-'0')]++;
		k-=(int)t[i]-'0';
	}
	if(k<0)
	cout<<0;
	else
	cout<<1;
	/*int ans=0;
	while(k>0){
		ans++;
		for(int i=0;i<9;i++)
			if(a[i]){
				a[i]--;
				k-=9-i;
			}
	}
	cout<<ans;*/
}


#include<iostream>
using namespace std;
int main(){
	int k,a[10];
	cin>>k;
	string t;
	cin>> t;
	for(int i=0;i<t.size();i++){
		a[((int)t[i]-'0')]++;
		k-=(int)t[i]-'0';
	}
	int ans=0;
	while(k>0){
		ans++;
		for(int i=0;i<9;i++)
			if(a[i]){
				a[i]--;
				k-=9-i;
			}
	}
	cout<<ans;
}


#include<iostream>
using namespace std;
int main(){
	int k,a[10];
	cin>>k;
	string t;
	cin>> t;
	for(int i=0;i<t.size();i++){
		a[((int)t[i]-'0')]++;
		k-=(int)t[i]-'0';
	}
	if(k<0)
	cout<<0;
	else
	cout<<k;
	/*int ans=0;
	while(k>0){
		ans++;
		for(int i=0;i<9;i++)
			if(a[i]){
				a[i]--;
				k-=9-i;
			}
	}
	cout<<ans;*/
}


#include<iostream>
using namespace std;
int k,a[10];
int main(){
	cin>>k;
	string t;
	cin>> t;
	for(int i=0;i<t.size();i++){
		a[((int)t[i]-'0')]++;
		k-=(int)t[i]-'0';
	}
	int ans=0;
	while(k>0){
		for(int i=0;i<9;i++)
			if(a[i]){
				a[i]--;
				k-=9-i;
				ans++;
			}
	}
	cout<<ans;
}


#include<iostream>
using namespace std;
int main(){
	int k,a[10];
	cin>>k;
	string t;
	cin>> t;
	for(int i=0;i<t.size();i++){
		a[((int)t[i]-'0')]++;
		k-=(int)t[i]-'0';
	}
	if(k<0)
	cout<<0;
	cout<<k;
	/*int ans=0;
	while(k>0){
		ans++;
		for(int i=0;i<9;i++)
			if(a[i]){
				a[i]--;
				k-=9-i;
			}
	}
	cout<<ans;*/
}


#include<iostream>
using namespace std;
int main(){
	int k,a[10];
	cin>>k;
	char t;
	for(int i=0;cin>>t;i++){
		a[((int)t-'0')]++;
		k-=(int)t-'0';
	}
	int ans;
	while(k>0){
		ans++;
		for(int i=0;i<9;i++)
			if(a[i]){
				a[i]--;
				k-=9-i;
			}
	}
	cout<<ans;
}


#include<iostream>
using namespace std;
int k,a[10];
int main(){
	cin>>k;
	string t;
	cin>> t;
	for(int i=0;i<t.size();i++){
		a[((int)t[i]-'0')]++;
		k-=(int)t[i]-'0';
	}
	int ans=0;
	while(k>0){
		for(int i=0;i<9;i++)
			if(a[i]){
				a[i]--;
				k-=9-i;
				ans++;
				break;
			}
	}
	cout<<ans;
}


#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    long long int k,a[100005],j,sum=0;;
    string n;
    cin>>k>>n;
    int len = n.size();
    for(int i=0;i<len;i++)
    {
        sum+=a[i]=n[i]-'0';
    }
    sort(a,a+len);
    for(j=0;sum<k;j++)
    {
        sum+=a[j];
        if(sum>=k)
        {
            j++;
            break;
        }
    }
    cout<<j<<endl;
    return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    long long int k,a[100005];
    string n;
    cin>>k>>n;
    int len = n.size();
    for(int i=0;i<len;i++)
    {
        a[i]=n[i]-'0';
    }
    sort(a,a+len);
    int i;
    for(i=0;k>0;i++)
    {
        k-=9-a[i];
    }
    cout<<i<<endl;
    return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    long long int k,a[100005];
    string n;
    cin>>k>>n;
    int len = n.size();
    for(int i=0;i<len;i++)
    {
        a[i]=n[i]-'0';
    }
    sort(a,a+len);
    long long int mark=0,sum=0;
    for(int i=0;i<len;i++)
    {
        sum+=9-a[i];
        if(sum>=k)
        {
            mark=i+1;
            break;
        }
    }
    cout<<mark<<endl;
    return 0;
}


#include<iostream>
using namespace std;
int main()
{
    int k,i,val,num,sum,mark;
    string n,str="";
    cin>>k>>n;
    val = n.size()-1;
    str=n;
    sum=0;
    while(sum<k)
    {
        if(n[val]=='9')
        {
            mark=1;
            break;
        }
        num = int(n[val]-'0') + 1;
        n[val]=char(num+'0');
        sum = 0;
        for(i=0;i<val+1;i++)
        {
            sum+=int(n[i]-'0');
        }
    }
    if(mark==1)
    {
        cout<<"0"<<endl;
    }
    else
    {
        int c=0;
        for(i=0;i<val+1;i++)
        {
            if(n[i]!=str[i])
            {
                c++;
            }
        }
        cout<<c<<endl;
    }
    return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    long long int k,a[100005],j=0,sum=0;;
    string n;
    cin>>k>>n;
    int len = n.size();
    for(int i=0;i<len;i++)
    {
        sum+=a[i]=n[i]-'0';
    }
    sort(a,a+len);
    if(sum<k){
        for(j=0;j<len;j++)
        {
            sum+=a[j];
            if(sum>=k)
            {
                j++;
                break;
            }
        }
    }
    cout<<j<<endl;
    return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    long long int k,a[100005],j=0,sum=0;;
    string n;
    cin>>k>>n;
    int len = n.size();
    for(int i=0;i<len;i++)
    {
        a[i]=n[i]-'0';
        sum+=a[i];
    }
    sort(a,a+len);
    if(sum<k){
        for(j=0;j<len;j++)
        {
            sum+=9-a[j];
            if(sum>=k)
            {
                j++;
                break;
            }
        }
    }
    cout<<j<<endl;
    return 0;
}


#include<iostream>
using namespace std;
int main()
{
    int k,i,val,num;
    string n,str="";
    cin>>k>>n;
    val = n.size()-1;
    for(i=0;i<val;i++)
    {
        str+=n[i];
    }
    num = int(n[val]-'0') + 1;
    str+=char(num+'0');
    if(n[val]=='9')
    {
        cout<<"0"<<endl;
    }
    else
    {
        int c=0;
        for(i=0;i<val+1;i++)
        {
            if(n[i]!=str[i])
            {
                c++;
            }
        }
        cout<<c<<endl;
    }
    return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    long long int k,a[100005],j=0,sum=0;;
    string n;
    cin>>k>>n;
    int len = n.size();
    for(int i=0;i<len;i++)
    {
        a[i]=n[i]-'0';
        sum+=a[i];
    }
    sort(a,a+len);
    if(sum<k){
        for(j=0;j<len;j++)
        {
            sum+=a[j];
            if(sum>=k)
            {
                j++;
                break;
            }
        }
    }
    cout<<j<<endl;
    return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    long long int k,a[100005];
    string n;
    cin>>k>>n;
    int len = n.size();
    for(int i=0;i<len;i++)
    {
        a[i]=n[i]-'0';
    }
    sort(a,a+len);
    int c;
    for(int i=0;i<len;i++)
    {
        k-=9-a[i];
        if(k<=0)
        {
            c=i+1;
            break;
        }
    }
    cout<<c<<endl;
    return 0;
}


#define lli long long int
#include <bits/stdc++.h>
#define arr lli a[n]; for(i=0;i<n;i++){ cin>>a[i]; }
#define suma for(i=0;i<n;i++) sum=(sum+a[i])%n;
#define ma *max_element(a,a+n);
#define mi *min_element(a,a+n);
#define br cout<<"\n";
#define pb push_back
#define mp make_pair
using namespace std;
lli sumofdig(lli n)
{
	lli i,j,k;
	k=n;
	i=0;
	while(n)
	{
		i+=n%10;
		n/=10;
	}
return i;
}

int main()
{
	lli i,j,k,l,r,m,n,x,y,t;
	cin>>k>>n;
  	x=sumofdig(n);
  	if(x>=k)
  	{
  	cout<<"0";
  	}
  	else
  	cout<<k-x;

  return 0;
}


#define lli long long int
#include <bits/stdc++.h>
#define arr lli a[n]; for(i=0;i<n;i++){ cin>>a[i]; }
#define suma for(i=0;i<n;i++) sum=(sum+a[i])%n;
#define ma *max_element(a,a+n);
#define mi *min_element(a,a+n);
#define br cout<<"\n";
#define pb push_back
#define mp make_pair
using namespace std;
lli sumofdig(lli n)
{
	lli i,j,k;

	i=0;
	while(n)
	{
		i+=n%10;
		n/=10;
	}
return i;
}

int main()
{
	lli i,j,k,l,r,m,n,x,y,t;
	cin>>k>>n;
  	x=sumofdig(n);

	  lli ans=0;
  		l=k-x;
  		if(l<0)
			break;

		  while(n)
		  {
		  	r=n%10;
		  	n/=10;
		  	if(r!=9)
			  ans++;
		  	l=l-(9-r);
			if(l<0)
			break;

		  }
  		cout<<ans;
	}
  return 0;
}


#define lli long long int
#include <bits/stdc++.h>
#define arr lli a[n]; for(i=0;i<n;i++){ cin>>a[i]; }
#define suma for(i=0;i<n;i++) sum=(sum+a[i])%n;
#define ma *max_element(a,a+n);
#define mi *min_element(a,a+n);
#define br cout<<"\n";
#define pb push_back
#define mp make_pair
using namespace std;
lli sumofdig(string n)
{
	lli i,j,k;

	k=0;
	//k=n.length();
	//cout<<k<<'\n';
	for(i=0;n[i];i++)
	{//	cout<<"i="<<i<<'\n';
	//	cout<<n[i]<<'\n';
	k+=n[i]-'0';
	//cout<<"i="<<i<<'\n';
	}
return k;
}

int main()
{
	lli i,j,k,l,r,m,x,y,t;
	cin>>k;
	string n;
	cin>>n;
  	x=sumofdig(n);

	  lli ans=0;
  		l=k-x;
  	//	cout<<x<<" "<<l<<'\n';
  		if(l<=0)
		{
			cout<<ans;
			return 0;
		}
		sort(n.begin(),n.end());
		for(i=0;n[i];i++)
		  {
		  	r=n[i]-'0';
		  	if(r!=9)
			  ans++;//cout<<n[i]<<'\n';
		  	l=l-(9-r);
		  	//cout<<l<<'\n';
			if(l<=0)
			break;
		  }

		  	//
		  	//	70
			//	3326631213   112333366
  		cout<<ans;

  return 0;
}


import java.util.LinkedList;
import java.util.Scanner;

public class S {
    static class Graph {
        private int numberOfVertices;
        private LinkedList<Integer>[] arr;
        private int c = 1;

        public Graph(int n) {
            numberOfVertices = n;
            arr = (LinkedList<Integer>[]) new LinkedList[n];
            for (int i = 0; i < arr.length; i++) {
                arr[i] = new LinkedList<>();
            }
        }

        public void addEdge(int source, int destination) {
            arr[source].add(destination);
            arr[destination].add(source);
        }

        public Integer DFSHelper(int v, boolean[] visited) {
            visited[v] = true;
            for (int l: arr[v]) {
                if (!visited[l]) {
                    c++;
                    DFSHelper(l, visited);
                }
            }
            return c;
        }

        public LinkedList<Integer> connectedComponents() {
            boolean[] visited = new boolean[numberOfVertices];
            LinkedList<Integer> toReturn = new LinkedList<>();

            for (int i = 0; i < visited.length; i++) {
                if (!visited[i]) {
                    int n = DFSHelper(i, visited);
                    toReturn.addLast(n);
                }
            }

            return toReturn;
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        for (int k = 0; k < t; k++) {
            int n = sc.nextInt();
            int[] arr = new int[n];
            for (int i = 0; i < arr.length; i++) {
                arr[i] = sc.nextInt();
            }

            Graph graph = new Graph(n);

            for (int i = 0; i < n; i++) {
                for (int j = i + 1; j < n; j++) {
                    if (arr[i] % 2 == arr[j] % 2 || Math.abs(arr[i] - arr[j]) == 1) {
                        graph.addEdge(i, j);
                    }
                }
            }

            LinkedList<Integer> connectedComponents = graph.connectedComponents();
            boolean success = true;
            for (int i = 0; i < connectedComponents.size(); i++) {
                if (connectedComponents.get(i) % 2 == 1) {
                    System.out.println("NO");
                    success = false;
                    break;
                }
            }

            if (success) {
                System.out.println("YES");
            }
        }
    }
}


import java.util.LinkedList;
import java.util.Scanner;

public class S {
    static class Graph {
        private int numberOfVertices;
        private LinkedList<Integer>[] arr;
        private int c = 1;

        public Graph(int n) {
            numberOfVertices = n;
            arr = (LinkedList<Integer>[]) new LinkedList[n];
            for (int i = 0; i < arr.length; i++) {
                arr[i] = new LinkedList<>();
            }
        }

        public void addEdge(int source, int destination) {
            arr[source].add(destination);
            arr[destination].add(source);
        }

        public Integer DFSHelper(int v, boolean[] visited) {
            visited[v] = true;
            for (int l: arr[v]) {
                if (!visited[l]) {
                    c++;
                    DFSHelper(l, visited);
                }
            }
            return c;
        }

        public LinkedList<Integer> connectedComponents() {
            boolean[] visited = new boolean[numberOfVertices];
            LinkedList<Integer> toReturn = new LinkedList<>();

            for (int i = 0; i < visited.length; i++) {
                if (!visited[i]) {
                    int n = DFSHelper(i, visited);
                    toReturn.addLast(n);
                    c = 1;
                }
            }

            return toReturn;
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        for (int k = 0; k < t; k++) {
            int n = sc.nextInt();
            int[] arr = new int[n];
            for (int i = 0; i < arr.length; i++) {
                arr[i] = sc.nextInt();
            }

            Graph graph = new Graph(n);

            for (int i = 0; i < n; i++) {
                for (int j = i + 1; j < n; j++) {
                    if (arr[i] % 2 == arr[j] % 2 || Math.abs(arr[i] - arr[j]) == 1) {
                        graph.addEdge(i, j);
                    }
                }
            }

            LinkedList<Integer> connectedComponents = graph.connectedComponents();
            boolean success = true;
            for (int i = 0; i < connectedComponents.size(); i++) {
                if (connectedComponents.get(i) % 2 == 1) {
                    System.out.println("NO");
                    success = false;
                    break;
                }
            }

            if (success) {
                System.out.println("YES");
            }
        }
    }
}


import java.util.*;

public class Solution{
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args){
        int t = sc.nextInt();
        while(t-->0){
            solve();
        }
    }

    public static void solve(){

        //always even
        int n = sc.nextInt();
        Set<Integer> set = new HashSet<Integer>();

        int even = 0, odd = 0, cons = 0;

        for(int i = 0;i < n;i++){
            int val = sc.nextInt();
            if(val % 2 == 0)even++;
            else odd++;

            if(set.contains(val - 1) || set.contains(val + 1))cons++;
            set.add(val);
        }

        if(even % 2 == 0 && odd % 2 == 0)System.out.println("YES");
        else if(even % 2 == 1 && odd % 2 == 1 && cons >= 0)System.out.println("YES");
        else System.out.println("NO");
    }
}


import java.util.*;

public class Solution{
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args){
        int t = sc.nextInt();
        while(t-->0){
            solve();
        }
    }

    public static void solve(){

        //always even
        int n = sc.nextInt();
        Set<Integer> set = new HashSet<Integer>();

        int even = 0, odd = 0, cons = 0;

        for(int i = 0;i < n;i++){
            int val = sc.nextInt();
            if(val % 2 == 0)even++;
            else odd++;

            if(set.contains(val - 1) || set.contains(val + 1))cons++;
            set.add(val);
        }

        if(even % 2 == 0 && odd % 2 == 0)System.out.println("YES");
        else if(even % 2 == 1 && odd % 2 == 1 && cons > 0)System.out.println("YES");
        else System.out.println("NO");
    }
}


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

//TYPEDEF
typedef long long ll;

// DEFINE SECTION

//IMPORTANT_FUNCTIONS

// OTHER_FUNCTIONS
//MAIN
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);

  ll t;
  cin >> t;
  while (t--)
  {
    int n;
    cin >> n;
    int a[n];
    int e = 0, o = 0;
    vector<int> ev, od;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    sort(a, a + n);
    for (int i = 0; i < n; i++) {
      if (a[i] % 2 == 0)
      {
        ++e;
        ev.push_back(a[i]);
      }
      else
      {
        ++o;
        od.push_back(a[i]);
      }
    }
    sort(od.begin(), od.end());
    sort(ev.begin(), ev.end());
    if (o % 2 != 0 && e % 2 != 0)
    {
      bool as = 1;
      for (int i = 0; i < o; i++)
      {
        for (int j = 0; j < e; j++)
        {
          if (abs(od[i] - ev[j]) == 1)
          {
            o--; e--;
            as = 0;
            break;
          }
          if (!as)
            break;
        }
      }
    }

    if (e % 2 == 0 && o % 2 == 0)
      cout << "YES\n";
    else
    {
      cout << "NO\n";
    }

  }
  return 0;
}


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

//TYPEDEF
typedef long long ll;

// DEFINE SECTION

//IMPORTANT_FUNCTIONS

// OTHER_FUNCTIONS
//MAIN
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    ll t;
    cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        int a[n];
        int e=0,o=0;
        vector<int> ev,od;
      for(int i=0;i<n;i++){
         cin>>a[i];
      }
      for(int i=0;i<n;i++)
      {
          if (a[i] % 2 == 0)
          {
              e++;
              ev.push_back(a[i]);
          }
          else
          {
              o++;
              od.push_back(a[i]);
          }
      }
        if(o%2!=0 && e%2!=0){
        for(int i=0;i<o;i++)
         {
            for(int j=0;j<e;j++)  {
             if(abs(od[i]-ev[j])==1)
             {
                      o--; e--;
                      break;
             }
            }
         }
        }
         if(e%2==0 && o%2==0)
           cout<<"YES\n";
         else
         {
             cout<<"NO\n";
         }

    }
    return 0;
}


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

//TYPEDEF
typedef long long ll;

// DEFINE SECTION

//IMPORTANT_FUNCTIONS

// OTHER_FUNCTIONS
//MAIN
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    ll t;
    cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        int a[n];
        int e=0,o=0;
        vector<int> ev,od;
      for(int i=0;i<n;i++){
         cin>>a[i];
      }
      sort(a,a+n);
      for(int i=0;i<n;i++){
          if (a[i] % 2 == 0)
          {
              ++e;
              ev.push_back(a[i]);
          }
          else
          {
              ++o;
              od.push_back(a[i]);
          }
      }
      if (o % 2 != 0 && e % 2 != 0)
      {
          bool as=1;
          for (int i = 0; i < o; i++)
          {
              for (int j = 0; j < e; j++)
              {
                  if (abs(od[i] - ev[j]) == 1)
                  {
                      o--; e--;
                      as=0;
                      break;
             }
             if(!as)
             break;
            }
         }
        }

         if(e%2==0 && o%2==0)
           cout<<"YES\n";
         else
         {
             cout<<"NO\n";
         }

    }
    return 0;
}


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

//TYPEDEF
typedef long long ll;

// DEFINE SECTION

//IMPORTANT_FUNCTIONS

// OTHER_FUNCTIONS
//MAIN
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);

  ll t;
  cin >> t;
  while (t--)
  {
    int n;
    cin >> n;
    int a[n];
    int e = 0, o = 0;
    vector<int> ev, od;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    sort(a, a + n);
    for (int i = 0; i < n; i++) {
      if (a[i] % 2 == 0)
      {
        ++e;
        ev.push_back(a[i]);
      }
      else
      {
        ++o;
        od.push_back(a[i]);
      }
    }
    sort(od.begin(), od.end());
    sort(ev.begin(), ev.end());
    if (o % 2 != 0 || e % 2 != 0)
    {
      bool as = 1;
      for (int i = 0; i < ev.size(); i++)
      {

        for (int j = 0; j < od.size(); j++)
        {
          if (abs(od[j] - ev[i]) == 1)
          {
            o--; e--;
            as = 0;
            break;
          }

        }
        if (!as)
          break;
      }
    }

    if (e % 2 == 0 || o % 2 == 0)
      cout << "YES\n";
    else
    {
      cout << "NO\n";
    }

  }
  return 0;
}


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

//TYPEDEF
typedef long long ll;

// DEFINE SECTION

//IMPORTANT_FUNCTIONS

// OTHER_FUNCTIONS
//MAIN
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    ll t;
    cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        int a[n];
        int e=0,o=0;
        vector<int> ev,od;
      for(int i=0;i<n;i++){
         cin>>a[i];
      }
      for(int i=0;i<n;i++)
      {
          if (a[i] % 2 == 0)
          {
              e++;
              ev.push_back(a[i]);
          }
          else
          {
              o++;
              od.push_back(a[i]);
          }
      }
        if(o%2!=0 && e%2!=0){
        for(int i=0;i<o;i++)
         {
            for(int j=0;j<e;j++)  {
             if(abs(od[i]-ev[j])==1)
             {
                      o--; e--;
             }
            }
         }
        }
         if(e%2==0 && o%2==0)
           cout<<"YES\n";
         else
         {
             cout<<"NO\n";
         }

    }
    return 0;
}


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

//TYPEDEF
typedef long long ll;

// DEFINE SECTION

//IMPORTANT_FUNCTIONS

// OTHER_FUNCTIONS
//MAIN
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);

  ll t;
  cin >> t;
  while (t--)
  {
    int n;
    cin >> n;
    int a[n];
    int e = 0, o = 0;
    vector<int> ev, od;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    sort(a, a + n);
    for (int i = 0; i < n; i++) {
      if (a[i] % 2 == 0)
      {
        ++e;
        ev.push_back(a[i]);
      }
      else
      {
        ++o;
        od.push_back(a[i]);
      }
    }
    sort(od.begin(), od.end());
    sort(ev.begin(), ev.end());
    if (o % 2 != 0 || e % 2 != 0)
    {
      bool as = 1;
      for (int i = 0; i < e; i++)
      {
        for (int j = 0; j < o; j++)
        {
          if (abs(od[i] - ev[j]) == 1)
          {
            o--; e--;
            as = 0;
            break;
          }
          if (!as)
            break;
        }
      }
    }

    if (e % 2 == 0 || o % 2 == 0)
      cout << "YES\n";
    else
    {
      cout << "NO\n";
    }

  }
  return 0;
}


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

//TYPEDEF
typedef long long ll;

// DEFINE SECTION

//IMPORTANT_FUNCTIONS

// OTHER_FUNCTIONS
//MAIN
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    ll t;
    cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        int a[n];
        int e=0,o=0;
      for(int i=0;i<n;i++)
         cin>>a[i];
      sort(a,a+n);
         for(int i=0;i<n;i+=2)
         {
             if(abs(a[i]-a[i+1])!=1)
             {
                 if(a[i]%2==0)
                    e++;
                 else
                 {
                     o++;
                 }
                 if(a[i+1]%2==0)
                   e++;
                 else
                 {
                     o++;
                 }

             }
             else
             {
                 continue;
             }

         }
         if(e%2==0 && o%2==0)
           cout<<"YES\n";
         else
         {
             cout<<"NO\n";
         }

    }
    return 0;
}


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

//TYPEDEF
typedef long long ll;

// DEFINE SECTION

//IMPORTANT_FUNCTIONS

// OTHER_FUNCTIONS
//MAIN
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    ll t;
    cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        int a[n];
        int e=0,o=0;
      for(int i=0;i<n;i++){
         cin>>a[i];
         if(a[i]%2==0)
          e++;
        else
        {
            o++;
        }
      }
        sort(a,a+n);
        for(int i=1;i<n;i++)
         {
             if(abs(a[i]-a[i-1])==1)
             {
                      o--; e--;
             }
         }
         if(e%2==0 && o%2==0)
           cout<<"YES\n";
         else
         {
             cout<<"NO\n";
         }

    }
    return 0;
}


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

//TYPEDEF
typedef long long ll;

// DEFINE SECTION

//IMPORTANT_FUNCTIONS

// OTHER_FUNCTIONS
//MAIN
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);

  ll t;
  cin >> t;
  while (t--)
  {
    int n;
    cin >> n;
    int a[n];
    int e = 0, o = 0;
    vector<int> ev, od;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    sort(a, a + n);
    for (int i = 0; i < n; i++) {
      if (a[i] % 2 == 0)
      {
        ++e;
        ev.push_back(a[i]);
      }
      else
      {
        ++o;
        od.push_back(a[i]);
      }
    }
    sort(od.begin(), od.end());
    sort(ev.begin(), ev.end());
    if (o % 2 != 0 || e % 2 != 0)
    {
      bool as = 1;
      for (int i = 0; i < e; i++)
      {
        for (int j = 0; j < o; j++)
        {
          if (abs(od[j] - ev[i]) == 1)
          {
            o--; e--;
            as = 0;
            break;
          }
          if (!as)
            break;
        }
      }
    }

    if (e % 2 == 0 || o % 2 == 0)
      cout << "YES\n";
    else
    {
      cout << "NO\n";
    }

  }
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,i;
    t=1;
    cin>>t;
    while(t--)
    {
        int n,m,ans=0,a[55],even=0,odd=0;
        cin>>n;
        for(i=1;i<=n;i++)
        {
            cin>>a[i];
            if(a[i]%2==0)
                even++;
            else
                odd++;
        }
        if(even%2==0 && odd%2==0)
        {
            cout<<"YES\n";
            continue;
        }
        even =0;
        odd=0;
        sort(a+1,a+n+1);
        for(i=1;i<=n;i+=2)
        {
            if(a[i+1]-a[i]==1)
                ;
            else
            {
                if(a[i]%2==0)
                    even++;
                else
                    odd++;
                if(a[i+1]%2==0)
                    even++;
                else
                    odd++;
            }
        }
        if(even%2==0 && odd%2==0)
            cout<<"YES\n";
        else
        {
            /*even =0;
            odd = 0;
            for(i=1;i<=n;i++)
            {
                if(a[i]%2==0)
                    even++;
                else
                    odd++;
            }
            if(even%2==0 && odd%2==0)
                cout<<"YES\n";
            else
               */ cout<<"NO\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,i;
    t=1;
    cin>>t;
    while(t--)
    {
        int n,m,ans=0,a[55],even=0,odd=0;
        cin>>n;
        for(i=1;i<=n;i++)
        {
            cin>>a[i];
            if(a[i]%2==0)
                even++;
            else
                odd++;
        }
        if(even%2==0 && odd%2==0)
        {
            cout<<"YES\n";
        }
        else
        {
            sort(a+1,a+n+1);
            even=0;
            odd=0;
            for(i=1;i<=n;i+=2)
            {
                if(a[i+1]-a[i]==1)
                    ;
                else
                {
                    if(a[i]%2==0)
                        even++;
                    else
                        odd++;
                    if(a[i+1]%2==0)
                        even++;
                    else
                        odd++;
                }
            }
            if(even%2==0 && odd%2==0)
                cout<<"YES\n";
            else
                cout<<"NO\n";
        }

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,i;
    t=1;
    cin>>t;
    while(t--)
    {
        int n,m,ans=0,a[55],even=0,odd=0;
        cin>>n;
        for(i=1;i<=n;i++)
        {
            cin>>a[i];
        }
        sort(a+1,a+n+1);
        for(i=1;i<=n;i+=2)
        {
            if(a[i+1]-a[i]==1)
                ;
            else
            {
                if(a[i]%2==0)
                    even++;
                else
                    odd++;
                if(a[i+1]%2==0)
                    even++;
                else
                    odd++;
            }
        }
        if(even%2==0 && odd%2==0)
            cout<<"YES\n";
        else
            cout<<"NO\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,i;
    t=1;
    cin>>t;
    while(t--)
    {
        int n,m,ans=0,a[55],even=0,odd=0;
        cin>>n;
        for(i=1;i<=n;i++)
        {
            cin>>a[i];
            if(a[i]%2==0)
                even++;
            else
                odd++;
        }
        if(even%2==0 && odd%2==0)
        {
            cout<<"YES\n";
            continue;
        }
        even =0;
        odd=0;
        sort(a+1,a+n+1);
        for(i=1;i<=n;i+=2)
        {
            if(a[i+1]-a[i]==1)
                ;
            else
            {
                if(a[i]%2==0)
                    even++;
                else
                    odd++;
                if(a[i+1]%2==0)
                    even++;
                else
                    odd++;
            }
        }
        if(even%2==0 && odd%2==0)
            cout<<"YES\n";
        else
        {
            even =0;
            odd = 0;
            for(i=1;i<=n;i++)
            {
                if(a[i]%2==0)
                    even++;
                else
                    odd++;
            }
            if(even%2==0 && odd%2==0)
                cout<<"YES\n";
            else
                cout<<"NO\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,i;
    t=1;
    cin>>t;
    while(t--)
    {
        int n,m,ans=0,a[55],even=0,odd=0;
        cin>>n;
        for(i=1;i<=n;i++)
        {
            cin>>a[i];
        }
        sort(a+1,a+n+1);
        for(i=1;i<=n;i+=2)
        {
            if(a[i+1]-a[i]==1)
                ;
            else
            {
                if(a[i]%2==0)
                    even++;
                else
                    odd++;
                if(a[i+1]%2==0)
                    even++;
                else
                    odd++;
            }
        }
        if(even%2==0 && odd%2==0)
            cout<<"YES\n";
        else
        {
            even =0;
            odd=0;
            for(i=1;i<=n;i++)
            {
                if(a[i]%2==0)
                    even++;
                else
                    odd++;
            }
            if(even%2==0 && odd%2==0)
                cout<<"YES\n";
            else
                cout<<"NO\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,i;
    t=1;
    cin>>t;
    while(t--)
    {
        int n,m,ans=0,a[55],even=0,odd=0;
        cin>>n;
        for(i=1;i<=n;i++)
        {
            cin>>a[i];
        }
        sort(a+1,a+n+1);
        for(i=1;i<=n;i+=2)
        {
            if(a[i+1]-a[i]==1)
                ;
            else
            {
                if(a[i]%2==0)
                    even++;
                else
                    odd++;
                if(a[i+1]%2==0)
                    even++;
                else
                    odd++;
            }
        }
        if(even%2==0 && odd%2==0)
            cout<<"YES\n";
        else
        {
            even =0;
            odd = 0;
            for(i=1;i<=n;i++)
            {
                if(a[i]%2==0)
                    even++;
                else
                    odd++;
            }
            if(even%2==0 && odd%2==0)
                cout<<"YES\n";
            else
                cout<<"NO\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,i;
    t=1;
    cin>>t;
    while(t--)
    {
        int n,ans=0,a[55],even=0,odd=0;
        cin>>n;
        for(i=1;i<=n;i++)
        {
            cin>>a[i];
            if(a[i]%2==0)
                even++;
            else
                odd++;
        }
        if(even%2==0 && odd%2==0)
        {
            cout<<"YES\n";
        }
        else
        {
            sort(a+1,a+n+1);
            even=0;
            odd=0;
            for(i=1;i<=n;i++)
            {
                if(a[i+1]-a[i]==1)
                    i++;
                else
                {
                    if(a[i]%2==0)
                        even++;
                    else
                        odd++;

                }
            }
            if(even%2==0 && odd%2==0)
                cout<<"YES\n";
            else
                cout<<"NO\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,i;
    t=1;
    cin>>t;
    while(t--)
    {
        int n,ans=0,x,even=0,odd=0;
        cin>>n;
        vector<int> a;
        for(i=0;i<n;i++)
        {
            cin>>x;
            a.push_back(x);
            if(a[i]%2==0)
                even++;
            else
                odd++;
        }
        if(even%2==0 && odd%2==0)
        {
            cout<<"YES\n";
            continue;
        }
        else
        {
            sort(a.begin(),a.end());
            for(i=0;i<a.size()-1;i++)
            {
                if(a[i+1]-a[i]==1)
                {
                    a.erase(a.begin()+i);
                    a.erase(a.begin()+i);
                    even--;
                    odd--;
                }
                if(even%2==0 && odd%2==0)
                    break;
            }
            if(even%2==0 && odd%2==0)
                cout<<"YES\n";
            else
                cout<<"NO\n";
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 5e5;
const int INF = 1e9;

#define ll long long
#define pb push_back
#define re return
#define fi first
#define se second

int a[N];

void solve ()
{
    int n, l=0, r=0, k=0, x, y;
    cin >> n;
    for (int i = 1; i <= n; ++i)
    {
        cin >> a[i];
        if (a[i]%2==0) l++;
        else r++;
    }
    x=l;
    y=r;
    sort(a+1,a+1+n);
    for (int i = 1; i < n; ++i)
    {
        if (abs(a[i]-a[i+1])==1)
        {
            a[i]=0;
            a[i+1]=0;
            i++;
            k++;
        }
    }
    l-=k;
    r-=k;
    //cout << ans << " ";
    if (l%2==0&&r%2==0) cout << "YES";
    else if (x%2==0&&y%2==0) cout << "YES";
    else cout << "NO";
}

int main ()
{
    int q;
    cin >> q;
    while (q--)
    {
        solve();
        cout << '\n';
    }
}


#include <bits/stdc++.h>

using namespace std;

const int N = 5e5;
const int INF = 1e9;

#define ll long long
#define pb push_back
#define re return
#define fi first
#define se second

int a[N];

void solve ()
{
    int n, ans=0, l=0, r=0, k=0;
    cin >> n;
    for (int i = 1; i <= n; ++i)
    {
        cin >> a[i];
        if (a[i]%2==0) l++;
        else r++;
    }
    sort(a+1,a+1+n);
    for (int i = 1; i < n; ++i)
    {
        if (abs(a[i]-a[i+1])==1)
        {
            ans++;
            a[i]=0;
            a[i+1]=0;
            i++;
            k++;
        }
    }
    sort(a+1,a+1+n);
    k*=2;
    for (int i = k; i < n; ++i)
    {
        if (abs(a[i]-a[i+1])==1)
        {
            ans++;
            i++;
        }
        else if (a[i]%2==1&&a[i+1]%2==1)
        {
            ans++;
            i++;
        }
        else if (a[i]%2==0&&a[i+1]%2==0)
        {
            ans++;
            i++;
        }
    }
    cout << ans << " ";
    if (l%2==0&&r%2==0) cout << "YES";
    else if (ans==n/2) cout << "YES";
    else cout << "NO";
}

int main ()
{
    int q;
    cin >> q;
    while (q--)
    {
        solve();
        cout << '\n';
    }
}


#include <bits/stdc++.h>

using namespace std;

const int N = 5e5;
const int INF = 1e9;

#define ll long long
#define pb push_back
#define re return
#define fi first
#define se second

int a[N];

void solve ()
{
    int n, ans=0, l=0, r=0;
    cin >> n;
    for (int i = 1; i <= n; ++i)
    {
        cin >> a[i];
        if (a[i]%2==0) l++;
        else r++;
    }
    sort(a+1,a+1+n);
    for (int i = 1; i < n; ++i)
    {
        if (abs(a[i]-a[i+1])==1)
        {
            ans++;
            i++;
        }
        else if (a[i]%2==1&&a[i+1]%2==1)
        {
            ans++;
            i++;
        }
        else if (a[i]%2==0&&a[i+1]%2==0)
        {
            ans++;
            i++;
        }
    }
    if (l%2==0&&r%2==0) cout << "YES";
    else if (ans==n/2) cout << "YES";
    else cout << "NO";
}

int main ()
{
    int q;
    cin >> q;
    while (q--)
    {
        solve();
        cout << '\n';
    }
}


#include <bits/stdc++.h>

using namespace std;

const int N = 5e5;
const int INF = 1e9;

#define ll long long
#define pb push_back
#define re return
#define fi first
#define se second

int a[N];

void solve ()
{
    int n, ans=0, l=0, r=0, k=0;
    cin >> n;
    for (int i = 1; i <= n; ++i)
    {
        cin >> a[i];
        if (a[i]%2==0) l++;
        else r++;
    }
    sort(a+1,a+1+n);
    for (int i = 1; i < n; ++i)
    {
        if (abs(a[i]-a[i+1])==1)
        {
            ans++;
            a[i]=0;
            a[i+1]=0;
            i++;
            k++;
        }
    }
    sort(a+1,a+1+n);
    k*=2;
    for (int i = k+1; i < n; ++i)
    {
        if (abs(a[i]-a[i+1])==1)
        {
            ans++;
            i++;
        }
        else if (a[i]%2==1&&a[i+1]%2==1)
        {
            ans++;
            i++;
        }
        else if (a[i]%2==0&&a[i+1]%2==0)
        {
            ans++;
            i++;
        }
    }
    //cout << ans << " ";
    if (l%2==0&&r%2==0) cout << "YES";
    else if (ans==n/2) cout << "YES";
    else cout << "NO";
}

int main ()
{
    int q;
    cin >> q;
    while (q--)
    {
        solve();
        cout << '\n';
    }
}


#include <bits/stdc++.h>

using namespace std;

const int N = 5e5;
const int INF = 1e9;

#define ll long long
#define pb push_back
#define re return
#define fi first
#define se second

int a[N];

void solve ()
{
    int n, ans=0, l=0, r=0;
    cin >> n;
    for (int i = 1; i <= n; ++i)
    {
        cin >> a[i];
        if (a[i]%2==0) l++;
        else r++;
    }
    sort(a+1,a+1+n);
    for (int i = 1; i < n; ++i)
    {
        if (abs(a[i]-a[i+1])==1)
        {
            ans++;
            i++;
        }
        else if (a[i]%2==1&&a[i+1]%2==1)
        {
            ans++;
            i++;
        }
        else if (a[i]%2==0&&a[i+1]%2==0)
        {
            ans++;
            i++;
        }
    }
    if (l%2==0&&r%2==0) cout << "YES1";
    else if (ans==n/2) cout << "YES2";
    else cout << "NO";
}

int main ()
{
    int q;
    cin >> q;
    while (q--)
    {
        solve();
        cout << '\n';
    }
}


#include <bits/stdc++.h>

using namespace std;

const int N = 5e5;
const int INF = 1e9;

#define ll long long
#define pb push_back
#define re return
#define fi first
#define se second

int a[N];

void solve ()
{
    int n, ans=0, l=0, r=0, k=0;
    cin >> n;
    for (int i = 1; i <= n; ++i)
    {
        cin >> a[i];
        if (a[i]%2==0) l++;
        else r++;
    }
    sort(a+1,a+1+n);
    for (int i = 1; i < n; ++i)
    {
        if (abs(a[i]-a[i+1])==1)
        {
            ans++;
            a[i]=0;
            a[i+1]=0;
            i++;
            k++;
        }
    }
    sort(a+1,a+1+n);
    k*=2;
    for (int i = k; i < n; ++i)
    {
        if (abs(a[i]-a[i+1])==1)
        {
            ans++;
            i++;
        }
        else if (a[i]%2==1&&a[i+1]%2==1)
        {
            ans++;
            i++;
        }
        else if (a[i]%2==0&&a[i+1]%2==0)
        {
            ans++;
            i++;
        }
    }
    //cout << ans << " ";
    if (l%2==0&&r%2==0) cout << "YES";
    else if (ans==n/2) cout << "YES";
    else cout << "NO";
}

int main ()
{
    int q;
    cin >> q;
    while (q--)
    {
        solve();
        cout << '\n';
    }
}


#include <bits/stdc++.h>

using namespace std;

const int N = 5e5;
const int INF = 1e9;

#define ll long long
#define pb push_back
#define re return
#define fi first
#define se second

int a[N];

void solve ()
{
    int n, ans=0, l=0, r=0;
    cin >> n;
    for (int i = 1; i <= n; ++i)
    {
        cin >> a[i];
        if (a[i]%2==0) l++;
        else r++;
    }
    sort(a+1,a+1+n);
    for (int i = 1; i <= n; ++i)
    {
        if (abs(a[i]-a[i+1])==1)
        {
            ans++;
            i++;
        }
        else if (i<n&&a[i]%2==1&&a[i+1]%2==1)
        {
            ans++;
            i++;
        }
        else if (i<n&&a[i]%2==0&&a[i+1]%2==0)
        {
            ans++;
            i++;
        }
    }
    if (l==r) cout << "YES";
    else if (ans==n/2) cout << "YES";
    else cout << "NO";
}

int main ()
{
    int q;
    cin >> q;
    while (q--)
    {
        solve();
        cout << '\n';
    }
}


#include <bits/stdc++.h>

using namespace std;

const int N = 5e5;
const int INF = 1e9;

#define ll long long
#define pb push_back
#define re return
#define fi first
#define se second

int a[N];

void solve ()
{
    int n, l=0, r=0, k=0;
    cin >> n;
    for (int i = 1; i <= n; ++i)
    {
        cin >> a[i];
        if (a[i]%2==0) l++;
        else r++;
    }
    sort(a+1,a+1+n);
    for (int i = 1; i < n; ++i)
    {
        if (abs(a[i]-a[i+1])==1)
        {
            ans++;
            a[i]=0;
            a[i+1]=0;
            i++;
            k++;
        }
    }
    l-=k;
    r-=k;
    //cout << ans << " ";
    if (l%2==0&&r%2==0) cout << "YES";
    else cout << "NO";
}

int main ()
{
    int q;
    cin >> q;
    while (q--)
    {
        solve();
        cout << '\n';
    }
}


#include <bits/stdc++.h>

using namespace std;

const int N = 5e5;
const int INF = 1e9;

#define ll long long
#define pb push_back
#define re return
#define fi first
#define se second

int a[N];

void solve ()
{
    int n, l=0, r=0, k=0;
    cin >> n;
    for (int i = 1; i <= n; ++i)
    {
        cin >> a[i];
        if (a[i]%2==0) l++;
        else r++;
    }
    sort(a+1,a+1+n);
    for (int i = 1; i < n; ++i)
    {
        if (abs(a[i]-a[i+1])==1)
        {
            a[i]=0;
            a[i+1]=0;
            i++;
            k++;
        }
    }
    l-=k;
    r-=k;
    //cout << ans << " ";
    if (l%2==0&&r%2==0) cout << "YES";
    else cout << "NO";
}

int main ()
{
    int q;
    cin >> q;
    while (q--)
    {
        solve();
        cout << '\n';
    }
}


#include <bits/stdc++.h>

using namespace std;

const int N = 5e5;
const int INF = 1e9;

#define ll long long
#define pb push_back
#define re return
#define fi first
#define se second

int a[N];

void solve ()
{
    int n, ans=0, l=0, r=0;
    cin >> n;
    for (int i = 1; i <= n; ++i)
    {
        cin >> a[i];
        if (a[i]%2==0) l++;
        else r++;
    }
    sort(a+1,a+1+n);
    for (int i = 1; i <= n; ++i)
    {
        if (abs(a[i]-a[i+1])==1)
        {
            ans++;
            i++;
        }
        else if (i<n&&a[i]%2==1&&a[i+1]%2==1)
        {
            ans++;
            i++;
        }
        else if (i<n&&a[i]%2==0&&a[i+1]%2==0)
        {
            ans++;
            i++;
        }
    }
    if (l%2==0&&r%2==0) cout << "YES";
    else if (ans==n/2) cout << "YES";
    else cout << "NO";
}

int main ()
{
    int q;
    cin >> q;
    while (q--)
    {
        solve();
        cout << '\n';
    }
}


#include <bits/stdc++.h>

using namespace std;

const int N = 5e5;
const int INF = 1e9;

#define ll long long
#define pb push_back
#define re return
#define fi first
#define se second

int a[N];

void solve ()
{
    int n, l=0, r=0, k=0, x, y;
    cin >> n;
    for (int i = 1; i <= n; ++i)
    {
        cin >> a[i];
        if (a[i]%2==0) l++;
        else r++;
    }
    x=l;
    y=r;
    sort(a+1,a+1+n);

    if (l%2==0&&r%2==0){
        cout << "YES";
        return ;
    }
    for (int i = 1; i < n; ++i)
    {
        if (abs(a[i]-a[i+1])==1)
        {
            a[i]=0;
            a[i+1]=0;
            i++;
            k++;
        }
    }
    if(k > 0) cout << "YES";
        else cout << "NO";
}

int main ()
{
    int q;
    cin >> q;
    while (q--)
    {
        solve();
        cout << '\n';
    }
}


#include <bits/stdc++.h>

using namespace std;

const int N = 5e5;
const int INF = 1e9;

#define ll long long
#define pb push_back
#define re return
#define fi first
#define se second

int a[N];

void solve ()
{
    int n, ans=0, l=0, r=0;
    cin >> n;
    for (int i = 1; i <= n; ++i)
    {
        cin >> a[i];
    }
    sort(a+1,a+1+n);
    for (int i = 1; i <= n; ++i)
    {
        if (abs(a[i]-a[i+1])==1)
        {
            ans++;
            i++;
        }
        else if (i<n&&a[i]%2==1&&a[i+1]%2==1)
        {
            ans++;
            i++;
        }
        else if (i<n&&a[i]%2==0&&a[i+1]%2==0)
        {
            ans++;
            i++;
        }
    }
    if (ans!=n/2) cout << "NO";
    else cout << "YES";
}

int main ()
{
    int q;
    cin >> q;
    while (q--)
    {
        solve();
        cout << '\n';
    }
}


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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t;
    cin >> t;

    while(t--){
        int n;
        cin >> n;
        int arr[n];
        for(int i=0; i<n; i++){
            cin >> arr[i];
        }
        sort(arr, arr+n);
        bool flag=true;
        bool check1 = (arr[1]-arr[0] == 1); // tova da e 1
        bool check2 = (arr[0]%2 == arr[1]%2); //tova da e vqrno
        if(check1 || check2){
            for(int i=3; i<n; i+=2){
                check1 = (arr[i]-arr[i-1] == 1);
                check2 = (arr[i]%2 == arr[i-1]%2);
                if(!(check1 || check2)){
                    cout << "NO" << endl;
                    flag=false;
                    break;
                }
            }
            if(flag){
                cout << "YES" << endl;
            }
        } else {
            cout << "NO" << endl;
        }

    }

    return 0;
}


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t;
    cin >> t;

    while(t--){
        int sum=0;
        int n;
        cin >> n;

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

        if(sum%2==0){
            cout << "Yes" << endl;
        } else {
            bool flag = false;
            sort(arr,arr+n);
            for(int i=1; i<n; i++){
                if(arr[i]==arr[i-1]+1){
                    flag=true;
                 }
            }
            if(flag){
                cout << "YES" << endl;
            } else {
                cout << "NO" << endl;
            }
        }
    }
    return 0;
}


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t;
    cin >> t;

    while(t--){
        int n;
        cin >> n;

        int even=0;
        int odd=0;

        int arr[n];
        for(int i=0; i<n; i++){
            cin>>arr[i];
            if(arr[i]%2==0){
                even++;
            } else {
                odd++;
            }
        }

        if(odd%2 != even%2){
            cout << "NO" << endl;
        } else {
            if (even%2==0){
                cout << "YES" << endl;
            } else {
                bool flag = true;
                for (int i = 0; i < n; i++) {
                    for (int j = i + 1; j < n; j++) {
                        if (arr[i] % 2 != arr[j] % 2 && abs(arr[i] - arr[j]) == 1) {
                            cout << "YES" <<  endl;
                            flag = false;
                            break;
                        }
                    }
                    if(!flag){
                        break;
                    }
                }
                if(flag){
                    cout << "NO" << endl;
                }
            }
        }
    }
    return 0;
}


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t;
    cin >> t;

    while(t--){
        int n;
        cin >> n;

        int even=0;
        int odd=0;

        int arr[n];
        for(int i=0; i<n; i++){
            cin>>arr[i];
            if(arr[i]%2==0){
                even++;
            } else {
                odd++;
            }
        }

        if(odd%2 != even%2){
            cout << "NO" << endl;
        } else {
            if (even%2==0){
                cout << "YES" << endl;
            } else {
                bool flag = true;
                for (int i = 0; i < n; i++) {
                for (int j = i + 1; j < n; j++) {
                    if (arr[i] % 2 != arr[j] % 2 && abs(arr[i] - arr[j]) == 1) {
                        cout << "YES" <<  endl;
                        flag = false;
                        break;
                    }
                }
            }
                if(flag){
                    cout << "NO" << endl;
                }
            }
        }
    }
    return 0;
}


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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t;
    cin >> t;

    while(t--){
        int n;
        cin >> n;
        int arr[n];

        int chetni=0;
        int nechetni=0;

        for(int i=0; i<n; i++){
            cin >> arr[i];
            if(arr[i]%2==0){
                chetni++;
            }
            if(arr[i]%2==1){
                nechetni++;
            }
        }
        if(chetni==nechetni){
            cout << "YES" << endl;
        } else {
            sort(arr, arr+n);
            bool flag = true;

            for(int i=1; i<n; i+=2){
                bool check1 = (arr[i]-arr[i-1] == 1);
                bool check2 = (arr[i]%2 == arr[i-1]%2);
                if(!(check1 || check2)){
                    cout << "NO" << endl;
                    flag=false;
                    break;
                }
            }
            if(flag){
                cout << "YES" << endl;
            }
        }
    }

    return 0;
}


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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t;
    cin >> t;

    while(t--){
        int n;
        cin >> n;
        int arr[n];
        for(int i=0; i<n; i++){
            cin >> arr[i];
        }
        sort(arr, arr+n);
        bool flag=true;
        bool check1 = (arr[1]-arr[0] == 1); // tova da e 1
        bool check2 = (arr[0]%2 == arr[1]%2); //tova da e vqrno
        if(check1 || check2){
            for(int i=3; i<n-1; i+=2){
                check1 = (arr[i]-arr[i-1] == 1);
                check2 = (arr[i]%2 == arr[i-1]%2);
                if(!(check1 || check2)){
                    cout << "NO" << endl;
                    flag=false;
                    break;
                }
            }
            if(flag){
                cout << "YES" << endl;
            }
        } else {
            cout << "NO" << endl;
        }
    }
    return 0;
}


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t;
    cin >> t;

    while(t--){
        int sum=0;
        int n;
        cin >> n;

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

        if(sum%2==0){
            cout << "Yes" << endl;
        } else {
            bool flag = false;
            sort(arr,arr+n);
            for(int i=1; i<n; i++){
                if(a[i]==a[i-1]+1){
                    flag=true;
                 }
            }
            if(flag){
                cout << "YES" << endl;
            } else {
                cout << "NO" << endl;
            }
        }
    }
    return 0;
}


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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t;
    cin >> t;

    while(t--){
        int n;
        cin >> n;
        int arr[n];

        int chetni=0;
        int nechetni=0;

        for(int i=0; i<n; i++){
            cin >> arr[i];
            if(arr[i]%2==0){
                chetni++;
            }
            if(arr[i]%2==1){
                nechetni++;
            }
        }

        if(chetni%2==0 && nechetni%2==0){
            cout << "YES" << endl;
        } else {
            sort(arr, arr+n);
            bool flag = true;

            for(int i=1; i<n; i+=2){
                bool check1 = (arr[i]-arr[i-1] == 1);
                bool check2 = (arr[i]%2 == arr[i-1]%2);
                if(!(check1 || check2)){
                    cout << "NO" << endl;
                    flag=false;
                    break;
                }
            }
            if(flag){
                cout << "YES" << endl;
            }
        }
    }

    return 0;
}


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t;
    cin >> t;

    while(t--){
        int n;
        cin >> n;

        int even=0;
        int odd=0;

        int arr[n];
        for(int i=0; i<n; i++){
            cin>>arr[i];
            if(arr[i]%2==0){
                even++;
            } else {
                odd++;
            }
        }

        if(odd%2 != even%2){
            cout << "NO" << endl;
        } else {
            if (odd%2==0 && even%2==0){
                cout << "YES" << endl;
            } else {
                bool flag = true;
                for (int i = 0; i < n; i++) {
                for (int j = i + 1; j < n; j++) {
                    if (arr[i] % 2 != arr[j] % 2 && abs(arr[i] - arr[j]) == 1) {
                        cout << "YES" <<  endl;
                        flag = false;
                        break;
                    }
                }
            }
                if(flag){
                    cout << "NO" << endl;
                }
            }
        }
    }
    return 0;
}


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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t;
    cin >> t;

    while(t--){
        int n;
        cin >> n;
        int arr[n];

        int chetni=0;
        int nechetni=0;

        for(int i=0; i<n; i++){
            cin >> arr[i];
            if(arr[i]%2==0){
                chetni++;
            }
            if(arr[i]%2==1){
                nechetni++;
            }
        }
        if(chetni==nechetni && chetni>1 && chetni%2==0){
            cout << "YES" << endl;
        } else {
            sort(arr, arr+n);
            bool flag = true;

            for(int i=1; i<n; i+=2){
                bool check1 = (arr[i]-arr[i-1] == 1);
                bool check2 = (arr[i]%2 == arr[i-1]%2);
                if(!(check1 || check2)){
                    cout << "NO" << endl;
                    flag=false;
                    break;
                }
            }
            if(flag){
                cout << "YES" << endl;
            }
        }
    }

    return 0;
}


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t;
    cin >> t;

    while(t--){
        int n;
        cin >> n;

        int even=0;
        int odd=0;

        int arr[n];
        for(int i=0; i<n; i++){
            cin>>arr[i];
            if(arr[i]%2==0){
                even++;
            } else {
                odd++;
            }
        }

        if(odd%2 != even%2){
            cout << "NO" << endl;
        } else if (odd%2==0 && even%2==0){
            cout << "YES" << endl;
        } else {
            bool flag = true;
            for (int i = 0; i < n; i++) {
                for (int j = i + 1; j < n; j++) {
                    if (arr[i] % 2 != arr[j] % 2 && abs(arr[i] - arr[j]) == 1) {
                        cout << "YES" <<  endl;
                        flag = false;
                        break;
                    }
                }
            }
            if(flag){
                cout << "NO" << endl;
            }
        }
    }
    return 0;
}