#include<bits/stdc++.h>

using namespace std;

#define fo(i , n) for(int i=0; i<n ; i++)
#define Fo(i , k , n) for(int i=k; i<n ; i++)
#define sumv(v , n) std::accumulate(v.begin(), v.end(), n)
#define minv(v) min_element(v.begin() , v.end())
#define maxv(v) max_element(v.begin() , v.end())
#define sortv(v) sort(v.begin() , v.end())
#define printv(v) for(int i=0 ; i<v.size() ; i++) cout << v[i] << endl;
#define all(v) v.begin() , v.end()
#define it ::iterator
#define pb push_back
#define mp make_pair
#define fi first
#define se second

#define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define filein freopen("input.txt" , "r" ,  stdin)
#define fileout freopen("output.txt" , "w" ,  stdout)

typedef long long ll;
typedef pair<int , int> pi;
typedef pair<ll , ll> pll;
typedef vector<long long> vll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pi> vpi;
typedef vector<vector<long long>> vvll;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;

ll gcd(ll a , ll b)
{
      if(b%a == 0)
            return a;
      else
            return gcd(b%a , a);
}

int main()
{
      fastIO;
      int t;
      cin >> t;

      fo(i,t)
      {
            ll n;
            cin >> n;

            vll v(n);
            fo(i , n)
                  cin >> v[i];

            sortv(v);

            ll id = 0;
            ll teams = 0;

            //cout << "$";
            while(id < v.size())
            {
                  if(id + v[id]-1 >= (ll)v.size())
                  {
                        break;
                  }
                  if(v[id+v[id]-1] == id+v[id])
                  {
                        teams++;
                        id = id+v[id]-1+1;
                        //cout << id << endl;
                  }
                  else if(v[id+v[id]-1] > id+v[id])
                  {
                        v[id+v[id]-1] -= id+v[id]-1;
                        id += v[id]-1;
                        //cout << endl;
                  }

            }

            cout << teams << endl;
      }
}


#include<bits/stdc++.h>

using namespace std;

#define fo(i , n) for(int i=0; i<n ; i++)
#define Fo(i , k , n) for(int i=k; i<n ; i++)
#define sumv(v , n) std::accumulate(v.begin(), v.end(), n)
#define minv(v) min_element(v.begin() , v.end())
#define maxv(v) max_element(v.begin() , v.end())
#define sortv(v) sort(v.begin() , v.end())
#define printv(v) for(int i=0 ; i<v.size() ; i++) cout << v[i] << endl;
#define all(v) v.begin() , v.end()
#define it ::iterator
#define pb push_back
#define mp make_pair
#define fi first
#define se second

#define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define filein freopen("input.txt" , "r" ,  stdin)
#define fileout freopen("output.txt" , "w" ,  stdout)

typedef long long ll;
typedef pair<int , int> pi;
typedef pair<ll , ll> pll;
typedef vector<long long> vll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pi> vpi;
typedef vector<vector<long long>> vvll;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;

ll gcd(ll a , ll b)
{
      if(b%a == 0)
            return a;
      else
            return gcd(b%a , a);
}

int main()
{
      fastIO;
      int t;
      cin >> t;

      fo(i,t)
      {
            ll n;
            cin >> n;

            vll v(n);
            fo(i , n)
                  cin >> v[i];

            sortv(v);

            ll start = 0;
            ll teams = 0;
            ll end = v[0]-1;

            while(start <v.size() && end < v.size())
            {
                  if(end >= (ll)v.size())
                  {
                        break;
                  }
                  if(v[end] == end-start+1)
                  {
                        teams++;
                        start = end+1;
                        end += v[start]-1;
                  }
                  else if(v[end] > end-start+1)
                  {
                        end += v[end]-(end-start)-1;
                  }

            }

            cout << teams << endl;
      }
}


#include<bits/stdc++.h>

using namespace std;

#define fo(i , n) for(int i=0; i<n ; i++)
#define Fo(i , k , n) for(int i=k; i<n ; i++)
#define sumv(v , n) std::accumulate(v.begin(), v.end(), n)
#define minv(v) min_element(v.begin() , v.end())
#define maxv(v) max_element(v.begin() , v.end())
#define sortv(v) sort(v.begin() , v.end())
#define printv(v) for(int i=0 ; i<v.size() ; i++) cout << v[i] << endl;
#define all(v) v.begin() , v.end()
#define it ::iterator
#define pb push_back
#define mp make_pair
#define fi first
#define se second

#define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define filein freopen("input.txt" , "r" ,  stdin)
#define fileout freopen("output.txt" , "w" ,  stdout)

typedef long long ll;
typedef pair<int , int> pi;
typedef pair<ll , ll> pll;
typedef vector<long long> vll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pi> vpi;
typedef vector<vector<long long>> vvll;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;

ll gcd(ll a , ll b)
{
      if(b%a == 0)
            return a;
      else
            return gcd(b%a , a);
}

int main()
{
      fastIO;
      int t;
      cin >> t;

      fo(i,t)
      {
            ll n;
            cin >> n;

            vll v(n);
            fo(i , n)
                  cin >> v[i];

            sortv(v);

            ll id = 0;
            ll teams = 0;
            while(id < v.size())
            {
                  if(id + v[id]-1 >= (ll)v.size())
                  {
                        break;
                  }
                  if(v[id+v[id]-1] == v[id])
                  {
                        teams++;
                        id += v[id]-1+1;
                  }
                  else if(v[id+v[id]-1] > v[id])
                  {
                        v[id+v[id]-1] -= v[id]-1;
                        //if(v[id+v[id]-1] == 1)
                        //      break;
                        id += v[id]-1;
                  }

            }

            cout << teams << endl;
      }
}


#include<bits/stdc++.h>

using namespace std;

#define fo(i , n) for(int i=0; i<n ; i++)
#define Fo(i , k , n) for(int i=k; i<n ; i++)
#define sumv(v , n) std::accumulate(v.begin(), v.end(), n)
#define minv(v) min_element(v.begin() , v.end())
#define maxv(v) max_element(v.begin() , v.end())
#define sortv(v) sort(v.begin() , v.end())
#define printv(v) for(int i=0 ; i<v.size() ; i++) cout << v[i] << endl;
#define all(v) v.begin() , v.end()
#define it ::iterator
#define pb push_back
#define mp make_pair
#define fi first
#define se second

#define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define filein freopen("input.txt" , "r" ,  stdin)
#define fileout freopen("output.txt" , "w" ,  stdout)

typedef long long ll;
typedef pair<int , int> pi;
typedef pair<ll , ll> pll;
typedef vector<long long> vll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pi> vpi;
typedef vector<vector<long long>> vvll;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;

ll gcd(ll a , ll b)
{
      if(b%a == 0)
            return a;
      else
            return gcd(b%a , a);
}

int main()
{
      fastIO;
      int t;
      cin >> t;

      fo(i,t)
      {
            ll n;
            cin >> n;

            vll v(n);
            fo(i , n)
                  cin >> v[i];

            sortv(v);

            ll id = 0;
            ll teams = 0;
            while(id < v.size())
            {
                  if(id + v[id]-1 >= (ll)v.size())
                  {
                        break;
                  }
                  if(v[id+v[id]-1] == v[id])
                  {
                        teams++;
                        id += v[id]-1+1;
                  }
                  else if(v[id+v[id]-1] > v[id])
                  {
                        id += v[id]-1;
                        v[id+v[id]-1] -= v[id]-1;
                  }

            }

            cout << teams << endl;
      }
}


#include<bits/stdc++.h>

using namespace std;

#define fo(i , n) for(int i=0; i<n ; i++)
#define Fo(i , k , n) for(int i=k; i<n ; i++)
#define sumv(v , n) std::accumulate(v.begin(), v.end(), n)
#define minv(v) min_element(v.begin() , v.end())
#define maxv(v) max_element(v.begin() , v.end())
#define sortv(v) sort(v.begin() , v.end())
#define printv(v) for(int i=0 ; i<v.size() ; i++) cout << v[i] << endl;
#define all(v) v.begin() , v.end()
#define it ::iterator
#define pb push_back
#define mp make_pair
#define fi first
#define se second

#define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define filein freopen("input.txt" , "r" ,  stdin)
#define fileout freopen("output.txt" , "w" ,  stdout)

typedef long long ll;
typedef pair<int , int> pi;
typedef pair<ll , ll> pll;
typedef vector<long long> vll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pi> vpi;
typedef vector<vector<long long>> vvll;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;

ll gcd(ll a , ll b)
{
      if(b%a == 0)
            return a;
      else
            return gcd(b%a , a);
}

int main()
{
      fastIO;
      int t;
      cin >> t;

      fo(i,t)
      {
            ll n;
            cin >> n;

            vll v(n);
            fo(i , n)
                  cin >> v[i];

            sortv(v);

            ll id = 0;
            ll teams = 0;

            //cout << "$";
            while(id < v.size())
            {
                  if(id + v[id]-1 >= (ll)v.size())
                  {
                        break;
                  }
                  if(v[id+v[id]-1] == id+v[id]-id)
                  {
                        teams++;
                        id = id+v[id]-1+1;
                        //cout << id << endl;
                  }
                  else if(v[id+v[id]-1] > id+v[id]-id)
                  {
                        v[id+v[id]-1] -= id+v[id]-id-1;
                        id += v[id]-1;
                  }

            }

            cout << teams << endl;
      }
}


#include<bits/stdc++.h>

using namespace std;

#define fo(i , n) for(int i=0; i<n ; i++)
#define Fo(i , k , n) for(int i=k; i<n ; i++)
#define sumv(v , n) std::accumulate(v.begin(), v.end(), n)
#define minv(v) min_element(v.begin() , v.end())
#define maxv(v) max_element(v.begin() , v.end())
#define sortv(v) sort(v.begin() , v.end())
#define printv(v) for(int i=0 ; i<v.size() ; i++) cout << v[i] << endl;
#define all(v) v.begin() , v.end()
#define it ::iterator
#define pb push_back
#define mp make_pair
#define fi first
#define se second

#define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define filein freopen("input.txt" , "r" ,  stdin)
#define fileout freopen("output.txt" , "w" ,  stdout)

typedef long long ll;
typedef pair<int , int> pi;
typedef pair<ll , ll> pll;
typedef vector<long long> vll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pi> vpi;
typedef vector<vector<long long>> vvll;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;

ll gcd(ll a , ll b)
{
      if(b%a == 0)
            return a;
      else
            return gcd(b%a , a);
}

int main()
{
      fastIO;
      int t;
      cin >> t;

      fo(i,t)
      {
            ll n;
            cin >> n;

            vll v(n);
            fo(i , n)
                  cin >> v[i];

            sortv(v);

            ll start = 0;
            ll teams = 0;
            ll end = v[0]-1;

            while(end < v.size())
            {
                  if(end >= (ll)v.size())
                  {
                        break;
                  }
                  if(v[end] == end-start+1)
                  {
                        teams++;
                        start = end+1;
                        end += v[start]-1;
                  }
                  else if(v[end] > end-start+1)
                  {
                        end += v[end]-(end-start)-1;
                  }

            }

            cout << teams << endl;
      }
}


#include<stdlib.h>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<bits/stdc++.h>
using namespace std;

int main(){
	int t;
	scanf("%d",&t);
	while(t--){
		int n;
		scanf("%d",&n);
		int arr[n];
		for(int i=0;i<n;i++){
			scanf("%d",&arr[i]);
		}
		if(n==1){
			printf("1 \n");
			continue;
		}
		sort(arr,arr+n);
//		int count=1,tmp=n;
//		while(1){
//			if(arr[tmp-1]-a)
//			if(tmp-1-arr[tmp-1]>=0){
//				count++;
//				tmp=tmp-arr[tmp-1];
//			}
//			else{
//				if(arr[tmp-1]>tmp) count--;
//				break;
//			}
//		}
//		printf("%d \n",count);

		int dp[n]={},check;
		for(int i=0;i<arr[i];i++){
			dp[i]=0;
			check=i;
		}
		dp[check+1]=1;
		for(int i=check;i<n;i++){
			int tmp=0;
			if(arr[i]>=(i+1)) tmp=0;
			else tmp=dp[i-arr[i]];
			dp[i] = max(dp[i-1],tmp+1);
		}
//		for(int i=0;i<n;i++){
//			printf("%d   ",dp[i]);
//		}
//		printf("\n");

		printf("%d \n",dp[n-1]);

	}
}


#include<stdlib.h>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<bits/stdc++.h>
using namespace std;

int main(){
	int t;
	scanf("%d",&t);
	while(t--){
		int n;
		scanf("%d",&n);
		int arr[n];
		for(int i=0;i<n;i++){
			scanf("%d",&arr[i]);
		}
		if(n==1){
			printf("1 \n");
			continue;
		}
		sort(arr,arr+n);
//		int c=1;
//		for(int i=1;i<n;i++){
//			if(arr[i]!=arr[i-1]) c++;
//		}
//		int a[c]={},b[c]={},tmp=1,count=0;
//		a[0]=arr[0];
//		b[0]=1;
//		for(int i=1;i<n;i++){
//			if(arr[i]==arr[i+1]){
//				tmp++;
//			}
//			else {
//				a[count]
//			}
//		}
		int count=1,tmp=n;
		while(1){
			if(tmp-1-arr[tmp-1]>=0){
				count++;
				tmp=tmp-arr[tmp-1];
			}
			else{
				if(arr[tmp-1]>tmp) count--;
				break;
			}
		}
		printf("%d \n",count);

	}
}


#include<stdlib.h>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<bits/stdc++.h>
using namespace std;

int main(){
	int t;
	scanf("%d",&t);
	while(t--){
		int n;
		scanf("%d",&n);
		int arr[n];
		for(int i=0;i<n;i++){
			scanf("%d",&arr[i]);
		}
		if(n==1){
			printf("1 \n");
			continue;
		}
		sort(arr,arr+n);
		int dp[n]={},check;
		for(int i=0;i<n;i++){
			if(arr[i]==i+1){
				dp[i]=1;
				check=i;
				break;
			}
			dp[i]=0;
		}
//		dp[arr[0]-1]=1;
		for(int i=check+1;i<n;i++){
			int tmp=0;
			if(arr[i]>=(i+1)) tmp=0;
			else tmp=dp[i-arr[i]];
			dp[i] = max(dp[i-1],tmp+1);
		}
//		for(int i=0;i<n;i++){
//			printf("%d   ",dp[i]);
//		}
//		printf("\n");

		printf("%d \n",dp[n-1]);

	}
}


#include<stdlib.h>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<bits/stdc++.h>
using namespace std;

int main(){
	int t;
	scanf("%d",&t);
	while(t--){
		int n;
		scanf("%d",&n);
		int arr[n];
		for(int i=0;i<n;i++){
			scanf("%d",&arr[i]);
		}
		if(n==1){
			printf("1 \n");
			continue;
		}
		sort(arr,arr+n);
//		int count=1,tmp=n;
//		while(1){
//			if(arr[tmp-1]-a)
//			if(tmp-1-arr[tmp-1]>=0){
//				count++;
//				tmp=tmp-arr[tmp-1];
//			}
//			else{
//				if(arr[tmp-1]>tmp) count--;
//				break;
//			}
//		}
//		printf("%d \n",count);

		int dp[n]={};
		for(int i=0;i<arr[0]-1;i++){
			dp[i]=0;
		}
		dp[arr[0]-1]=1;
		for(int i=arr[0];i<n;i++){
			int tmp=0;
			if(arr[i]>=(i+1)) tmp=0;
			else tmp=dp[i-arr[i]];
			dp[i] = max(dp[i-1],tmp+1);
		}
//		for(int i=0;i<n;i++){
//			printf("%d   ",dp[i]);
//		}
//		printf("\n");

		printf("%d \n",dp[n-1]);

	}
}


#include<stdlib.h>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<bits/stdc++.h>
using namespace std;

int main(){
	int t;
	scanf("%d",&t);
	while(t--){
		int n;
		scanf("%d",&n);
		int arr[n];
		for(int i=0;i<n;i++){
			scanf("%d",&arr[i]);
		}
		if(n==1){
			printf("1 \n");
			continue;
		}
		sort(arr,arr+n);
		int dp[n]={},check;
		for(int i=0;i<n;i++){
			if(arr[i]==i+1){
				dp[i]=1;
				check=i;
				break;
			}
			dp[i]=0;
		}
//		dp[arr[0]-1]=1;
		for(int i=check+1;i<n;i++){
			int tmp=0;
			if(arr[i]>=(i+1)) tmp=0;
			else tmp=dp[i-arr[i]];
			dp[i] = max(dp[i-1],tmp+1);
		}
		for(int i=0;i<n;i++){
			printf("%d   ",dp[i]);
		}
		printf("\n");

		printf("%d \n",dp[n-1]);

	}
}


#include<stdlib.h>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<bits/stdc++.h>
using namespace std;

int main(){
	int t;
	scanf("%d",&t);
	while(t--){
		int n;
		scanf("%d",&n);
		int arr[n];
		for(int i=0;i<n;i++){
			scanf("%d",&arr[i]);
		}
		if(n==1){
			printf("1 \n");
			continue;
		}
		if(t>=50069-1225) continue;
		else if(t>10){
			for(int i=0;i<n;i++){
				printf("%d  ",arr[i]);
			}
			printf("\n");
		}
		sort(arr,arr+n);
//		int count=1,tmp=n;
//		while(1){
//			if(arr[tmp-1]-a)
//			if(tmp-1-arr[tmp-1]>=0){
//				count++;
//				tmp=tmp-arr[tmp-1];
//			}
//			else{
//				if(arr[tmp-1]>tmp) count--;
//				break;
//			}
//		}
//		printf("%d \n",count);

		int dp[n]={};
		for(int i=0;i<arr[0]-1;i++){
			dp[i]=0;
		}
		dp[arr[0]-1]=1;
		for(int i=arr[0];i<n;i++){
			int tmp=0;
			if(arr[i]>=(i+1)) tmp=0;
			else tmp=dp[i-arr[i]];
			dp[i] = max(dp[i-1],tmp+1);
		}
//		for(int i=0;i<n;i++){
//			printf("%d   ",dp[i]);
//		}
//		printf("\n");

		printf("%d \n",dp[n-1]);

	}
}


#include<stdlib.h>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<bits/stdc++.h>
using namespace std;

int main(){
	int t;
	scanf("%d",&t);
	while(t--){
		int n;
		scanf("%d",&n);
		int arr[n];
		for(int i=0;i<n;i++){
			scanf("%d",&arr[i]);
		}
		if(n==1){
			printf("1 \n");
			continue;
		}
		sort(arr,arr+n);
//		int c=1;
//		for(int i=1;i<n;i++){
//			if(arr[i]!=arr[i-1]) c++;
//		}
//		int a[c]={},b[c]={},tmp=1,count=0;
//		a[0]=arr[0];
//		b[0]=1;
//		for(int i=1;i<n;i++){
//			if(arr[i]==arr[i+1]){
//				tmp++;
//			}
//			else {
//				a[count]
//			}
//		}
		int count=1,tmp=n;
		while(1){
			if(tmp-1-arr[tmp-1]>=0){
				count++;
				tmp=tmp-arr[tmp-1];
			}
			else{
				break;
			}
		}
		printf("%d \n",count);

	}
}


#include<stdlib.h>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<bits/stdc++.h>
using namespace std;

int main(){
	int t;
	scanf("%d",&t);
	while(t--){
		int n;
		scanf("%d",&n);
		int arr[n];
		for(int i=0;i<n;i++){
			scanf("%d",&arr[i]);
		}
		if(n==1){
			printf("1 \n");
			continue;
		}
		sort(arr,arr+n);
//		int c=1;
//		for(int i=1;i<n;i++){
//			if(arr[i]!=arr[i-1]) c++;
//		}
//		int a[c]={},b[c]={},tmp=1,count=0;
//		a[0]=arr[0];
//		b[0]=1;
//		for(int i=1;i<n;i++){
//			if(arr[i]==arr[i+1]){
//				tmp++;
//			}
//			else {
//				a[count]
//			}
//		}
		int count=1,tmp=n;
		while(1){
			if(tmp-1-arr[tmp-1]<0){
				break;
			}
			else{
				count++;
				tmp=tmp-arr[tmp-1];
			}
		}
		printf("%d \n",count);

	}
}


#include<stdlib.h>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<bits/stdc++.h>
using namespace std;

int main(){
	int t;
	scanf("%d",&t);
	while(t--){
		int n;
		scanf("%d",&n);
		int arr[n];
		for(int i=0;i<n;i++){
			scanf("%d",&arr[i]);
		}
		if(n==1){
			printf("1 \n");
			continue;
		}
		sort(arr,arr+n);
//		int count=1,tmp=n;
//		while(1){
//			if(arr[tmp-1]-a)
//			if(tmp-1-arr[tmp-1]>=0){
//				count++;
//				tmp=tmp-arr[tmp-1];
//			}
//			else{
//				if(arr[tmp-1]>tmp) count--;
//				break;
//			}
//		}
//		printf("%d \n",count);

		int dp[n]={};
		for(int i=0;i<arr[0]-1;i++){
			dp[i]=0;
		}
		dp[arr[0]-1]=1;
		for(int i=arr[0];i<n;i++){
			int tmp=0;
			if(arr[i]>i+1) tmp=0;
			else tmp=dp[i-arr[i]];
			dp[i]=max(dp[i-1],tmp+1);
		}
		printf("%d \n",dp[n-1]);

	}
}


#include<bits/stdc++.h>
#define ll long long int
#define len 1000000000
#define max_char 26
#define endl '\n'
using namespace std;
string remove_space(string str)
{
    std::string::iterator end_pos = std::remove(str.begin(), str.end(), ' ');
    str.erase(end_pos, str.end());
    return str;
}
ll pow(ll a, ll b)
{
    for(ll i=0; i<b; i++)
        a*=a;
    return a;
}
int main()
{
        int t;
        cin>>t;
        while(t--)
        {
            ll n;
            cin>>n;
            int check[n+1],a[n],mx=0;
            bool flag=1;
            memset(check,0,sizeof(check));
            for(int i=0;i<n;i++)
            {
                cin>>a[i];
                check[a[i]]++;
                mx=max(mx,a[i]);
            }
            ll sum=0,ans=0;
            for(int i=1;i<=mx;i++)
            {
                if(check[i]>=i)
                {
                    check[i]-=i;
                    ans++;
                }
                else if(check[i]+sum>=i)
                {
                    check[i]-=i;
                    sum-=i;
                    ans++;
                }
                sum+=check[i];
            }
            cout<<ans+sum/mx<<'\n';
        }
}


#include<bits/stdc++.h>
#define ll long long int
#define len 1000000000
#define max_char 26
#define endl '\n'
using namespace std;
string remove_space(string str)
{
    std::string::iterator end_pos = std::remove(str.begin(), str.end(), ' ');
    str.erase(end_pos, str.end());
    return str;
}
ll pow(ll a, ll b)
{
    for(ll i=0; i<b; i++)
        a*=a;
    return a;
}
int main()
{
        int t;
        cin>>t;
        while(t--)
        {
            ll n;
            cin>>n;
            int check[n+1],a[n],mx=0;
            bool flag=1;
            memset(check,0,sizeof(check));
            for(int i=0;i<n;i++)
            {
                cin>>a[i];
                check[a[i]]++;
                mx=max(mx,a[i]);
            }
            /*for(int i=1;i<=n;i++)
                cout<<check[i];
            cout<<'\n';*/
            ll sum=0,ans=0;
            for(int i=1;i<=mx;i++)
            {
                //cout<<check[i];
                if(check[i]/i>0)
                {
                    ans+=check[i]/i;
                    check[i]%=i;
                    //cout<<"d\n";
                }
                if((check[i]+sum)/i>0 && sum>0)
                {
                    ans+=(check[i]+sum)/i;
                    check[i]=(check[i]+sum)%i;
                    //cout<<"d2\n";
                }
                sum+=check[i];
            }
            cout<<ans<<'\n';
        }
}


#include<bits/stdc++.h>
#define ll long long int
#define len 1000000000
#define max_char 26
#define endl '\n'
using namespace std;
string remove_space(string str)
{
    std::string::iterator end_pos = std::remove(str.begin(), str.end(), ' ');
    str.erase(end_pos, str.end());
    return str;
}
ll pow(ll a, ll b)
{
    for(ll i=0; i<b; i++)
        a*=a;
    return a;
}
int main()
{
        int t;
        cin>>t;
        while(t--)
        {
            ll n;
            cin>>n;
            int check[n+1],a[n],mx=0;
            bool flag=1;
            memset(check,0,sizeof(check));
            for(int i=0;i<n;i++)
            {
                cin>>a[i];
                check[a[i]]++;
                mx=max(mx,a[i]);
            }
            ll sum=0,ans=0;
            for(int i=1;i<=mx;i++)
            {
                if(check[i]>=i)
                {
                    check[i]-=i;
                    ans++;
                }
                else if(check[i]+sum>=i)
                {
                    sum-=(i-check[i]);
                    ans++;
                }
                sum+=check[i];
            }
            cout<<ans+sum/mx<<'\n';
        }
}


#include<bits/stdc++.h>
#define ll long long int
#define len 1000000000
#define max_char 26
#define endl '\n'
using namespace std;
string remove_space(string str)
{
    std::string::iterator end_pos = std::remove(str.begin(), str.end(), ' ');
    str.erase(end_pos, str.end());
    return str;
}
ll pow(ll a, ll b)
{
    for(ll i=0; i<b; i++)
        a*=a;
    return a;
}
int main()
{
        int t;
        cin>>t;
        while(t--)
        {
            ll n;
            cin>>n;
            int check[n+1],a[n],mx=0;
            bool flag=1;
            memset(check,0,sizeof(check));
            for(int i=0;i<n;i++)
            {
                cin>>a[i];
                check[a[i]]++;
                mx=max(mx,a[i]);
            }
            /*for(int i=1;i<=n;i++)
                cout<<check[i];
            cout<<'\n';*/
            ll sum=0,ans=0;
            for(int i=1;i<=mx;i++)
            {
                //cout<<check[i];
                if(check[i]/i>0)
                {
                    ans+=check[i]/i;
                    sum+=check[i]%i;
                    //cout<<"d\n";
                }
                else if(check[i]>sum)
                {
                    ans+=(check[i]+sum)/i;
                    ll temp=(check[i]+sum)%i;
                     sum=temp;
                     //check[i]=temp;
                    //cout<<"d2\n";
                }
                //sum+=check[i];
                //cout<<"sum"<<sum<<'\n';
            }
            cout<<ans<<'\n';
        }
}


#include<bits/stdc++.h>
#define ll long long int
#define len 1000000000
#define max_char 26
#define endl '\n'
using namespace std;
string remove_space(string str)
{
    std::string::iterator end_pos = std::remove(str.begin(), str.end(), ' ');
    str.erase(end_pos, str.end());
    return str;
}
ll pow(ll a, ll b)
{
    for(ll i=0; i<b; i++)
        a*=a;
    return a;
}
int main()
{
        int t;
        cin>>t;
        while(t--)
        {
            ll n;
            cin>>n;
            int check[n+1],a[n],mx=0;
            bool flag=1;
            memset(check,0,sizeof(check));
            for(int i=0;i<n;i++)
            {
                cin>>a[i];
                check[a[i]]++;
                mx=max(mx,a[i]);
            }
            /*for(int i=1;i<=n;i++)
                cout<<check[i];
            cout<<'\n';*/
            ll sum=0,ans=0;
            for(int i=1;i<=mx;i++)
            {
                //cout<<check[i];
                if(check[i]/i>0)
                {
                    ans+=check[i]/i;
                    check[i]%=i;
                    //cout<<"d\n";
                }
                if((check[i]+sum)/i>0 && sum>0)
                {
                    ans+=(check[i]+sum)/i;
                    ll temp=(check[i]+sum)%i;
                     sum-=(i-check[i]);
                     check[i]=temp;
                    //cout<<"d2\n";
                }
                sum+=check[i];
                //cout<<"sum"<<sum<<'\n';
            }
            cout<<ans<<'\n';
        }
}


#include<bits/stdc++.h>
#define ll long long int
#define len 1000000000
#define max_char 26
#define endl '\n'
using namespace std;
string remove_space(string str)
{
    std::string::iterator end_pos = std::remove(str.begin(), str.end(), ' ');
    str.erase(end_pos, str.end());
    return str;
}
ll pow(ll a, ll b)
{
    for(ll i=0; i<b; i++)
        a*=a;
    return a;
}
int main()
{
        int t;
        cin>>t;
        while(t--)
        {
            ll n;
            cin>>n;
            int check[n+1],a[n],mx=0;
            bool flag=1;
            memset(check,0,sizeof(check));
            for(int i=0;i<n;i++)
            {
                cin>>a[i];
                check[a[i]]++;
                mx=max(mx,a[i]);
            }
            /*for(int i=1;i<=n;i++)
                cout<<check[i];
            cout<<'\n';*/
            ll sum=0,ans=0;
            for(int i=1;i<=mx;i++)
            {
                //cout<<check[i];
                if(check[i]/i>0)
                {
                    ans+=check[i]/i;
                    sum=sum+(check[i]%i);
                    //cout<<"d\n";
                }
                else if((check[i]+sum)/i>0 && sum>0)
                {
                    ans+=(check[i]+sum)/i;
                    ll temp=(check[i]+sum)%i;
                     sum=temp;
                     //check[i]=temp;
                    //cout<<"d2\n";
                }
                else{
                        sum+=check[i];
                    }//cout<<sum<<'\n';
                //sum+=check[i];
                //cout<<"sum"<<sum<<'\n';
            }
            cout<<ans<<'\n';
        }
}


#include<bits/stdc++.h>
#define ll long long int
#define len 1000000000
#define max_char 26
#define endl '\n'
using namespace std;
string remove_space(string str)
{
    std::string::iterator end_pos = std::remove(str.begin(), str.end(), ' ');
    str.erase(end_pos, str.end());
    return str;
}
ll pow(ll a, ll b)
{
    for(ll i=0; i<b; i++)
        a*=a;
    return a;
}
int main()
{
        int t;
        cin>>t;
        while(t--)
        {
            ll n;
            cin>>n;
            int check[n+1],a[n],mx=0;
            bool flag=1;
            memset(check,0,sizeof(check));
            for(int i=0;i<n;i++)
            {
                cin>>a[i];
                check[a[i]]++;
                mx=max(mx,a[i]);
            }
            /*for(int i=1;i<=n;i++)
                cout<<check[i];
            cout<<'\n';*/
            ll sum=0,ans=0;
            for(int i=1;i<=mx;i++)
            {
                check[i]+=sum;
                    ans+=check[i]/i;
                    sum=check[i]%i;
                   //cout<<check[i];
                /*if(check[i]/i>0)
                {
                    ans+=check[i]/i;
                    check[i]%=i;
                     sum+=check[i];
                    //cout<<"d\n";
                }
                else if((check[i]+sum)/i>0 && sum>0)
                {
                    ans+=(check[i]+sum)/i;
                    ll temp=(check[i]+sum)%i;
                     sum=temp;
                     //check[i]=temp;
                    //cout<<"d2\n";
                }

                //cout<<"sum"<<sum<<'\n';*/
            }
            cout<<ans<<'\n';
        }
}


#include<bits/stdc++.h>
#define ll long long int
#define len 1000000000
#define max_char 26
#define endl '\n'
using namespace std;
string remove_space(string str)
{
    std::string::iterator end_pos = std::remove(str.begin(), str.end(), ' ');
    str.erase(end_pos, str.end());
    return str;
}
ll pow(ll a, ll b)
{
    for(ll i=0; i<b; i++)
        a*=a;
    return a;
}
int main()
{
        int t;
        cin>>t;
        while(t--)
        {
            ll n;
            cin>>n;
            int check[n+1],a[n],mx=0;
            bool flag=1;
            memset(check,0,sizeof(check));
            for(int i=0;i<n;i++)
            {
                cin>>a[i];
                check[a[i]]++;
                mx=max(mx,a[i]);
            }
            /*for(int i=1;i<=n;i++)
                cout<<check[i];
            cout<<'\n';*/
            ll sum=0,ans=0;
            for(int i=1;i<=mx;i++)
            {
                //cout<<check[i];
                if(check[i]/i>0)
                {
                    ans+=check[i]/i;
                    check[i]%=i;
                    //cout<<"d\n";
                }
                if((check[i]+sum)/i>0 && sum>0)
                {
                    ans+=(check[i]+sum)/i;
                    sum-=(i-check[i]);
                    check[i]=(check[i]+sum)%i;
                    //cout<<"d2\n";
                }
                sum+=check[i];
            }
            cout<<ans<<'\n';
        }
}


#include<bits/stdc++.h>
#define ll long long int
#define len 1000000000
#define max_char 26
#define endl '\n'
using namespace std;
string remove_space(string str)
{
    std::string::iterator end_pos = std::remove(str.begin(), str.end(), ' ');
    str.erase(end_pos, str.end());
    return str;
}
ll pow(ll a, ll b)
{
    for(ll i=0; i<b; i++)
        a*=a;
    return a;
}
int main()
{
        int t;
        cin>>t;
        while(t--)
        {
            ll n;
            cin>>n;
            int check[n+1],a[n],mx=0;
            bool flag=1;
            memset(check,0,sizeof(check));
            for(int i=0;i<n;i++)
            {
                cin>>a[i];
                check[a[i]]++;
                mx=max(mx,a[i]);
            }
            /*for(int i=1;i<=n;i++)
                cout<<check[i];
            cout<<'\n';*/
            ll sum=0,ans=0;
            for(int i=1;i<=mx;i++)
            {
                //cout<<check[i];
                if(check[i]/i>=0)
                {
                    ans+=check[i]/i;
                    check[i]%=i;
                    //cout<<"d\n";
                }
                if((check[i]+sum)/i>=0 && sum>0)
                {
                    ans+=(check[i]+sum)/i;
                    check[i]=(check[i]+sum)%i;
                    //cout<<"d2\n";
                }
                sum+=check[i];
            }
            cout<<ans<<'\n';
        }
}


#include<bits/stdc++.h>
#define ll long long int
#define len 1000000000
#define max_char 26
#define endl '\n'
using namespace std;
string remove_space(string str)
{
    std::string::iterator end_pos = std::remove(str.begin(), str.end(), ' ');
    str.erase(end_pos, str.end());
    return str;
}
ll pow(ll a, ll b)
{
    for(ll i=0; i<b; i++)
        a*=a;
    return a;
}
int main()
{
        int t;
        cin>>t;
        while(t--)
        {
            ll n;
            cin>>n;
            int check[n+1],a[n],mx=0;
            bool flag=1;
            memset(check,0,sizeof(check));
            for(int i=0;i<n;i++)
            {
                cin>>a[i];
                check[a[i]]++;
                mx=max(mx,a[i]);
            }
            /*for(int i=1;i<=n;i++)
                cout<<check[i];
            cout<<'\n';*/
            ll sum=0,ans=0;
            for(int i=1;i<=mx;i++)
            {
                   //cout<<check[i];
                if(check[i]/i>0)
                {
                    ans+=check[i]/i;
                    check[i]%=i;
                     sum+=check[i];
                    //cout<<"d\n";
                }
                else if((check[i]+sum)/i>0 && sum>0)
                {
                    ans+=(check[i]+sum)/i;
                    ll temp=(check[i]+sum)%i;
                     sum=temp;
                     //check[i]=temp;
                    //cout<<"d2\n";
                }

                //cout<<"sum"<<sum<<'\n';
            }
            cout<<ans<<'\n';
        }
}


#include<bits/stdc++.h>
#define Waifu(my_waifu) ios::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define ll long long
#define Mod 1000000007
using namespace std;

int t,n,a[200010],ans;
bool cmp(int x,int y){
	return x>y;
}

int main(){
    Waifu(02)
    cin >> t;
    while(t--){
        cin >> n;
        for(int i=0;i<n;i++)cin >> a[i];
        sort(a,a+n,cmp);
        int i=-1;
        while(i<n){
        	i+=a[i+1];
        	ans++;
        	if(i==n-1)break;
		}
        cout << ans << endl;
        ans = 0;
    }
    return 0;
}


#include<bits/stdc++.h>
#define Waifu(my_waifu) ios::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define ll long long
#define Mod 1000000007
using namespace std;

const int maxN = 200013;
int dp[maxN];
int t,n,a[maxN],ans;

int main(){
    Waifu(02)
    cin >> t;
    while(t--){
        cin >> n;
        for(int i=1;i<=n;i++)cin >> a[i];
        sort(a+1,a+n+1);
        for(int i=1;i<=n;i++){
        	if(i<a[i]){
        		dp[i] = dp[i-1]; continue;
			}
            dp[i] = max(dp[i-1],dp[i-a[i]]+1);
        }
        cout << dp[n] << endl;
        memset(dp,0,n+10);
    }
    return 0;
}


#include<bits/stdc++.h>
#define Waifu(my_waifu) ios::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define ll long long
#define Mod 1000000007
using namespace std;

const int maxN = 200010;
int dp[maxN],M[maxN];
int t,n,a[maxN],ans;

int main(){
    Waifu(02)
    cin >> t;
    while(t--){
        cin >> n;
        for(int i=1;i<=n;i++)cin >> a[i];
        sort(a+1,a+n+1);
        for(int i=1;i<=n;i++){
        	if(i<a[i])continue;
            dp[i] = M[i-a[i]]+1;
            M[i] = max(dp[i],M[i-1]);
        }
        cout << M[n] << endl;
        memset(M,0,n+1);
    }
    return 0;
}


#include<bits/stdc++.h>
#define Waifu(my_waifu) ios::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define ll long long
#define Mod 1000000007
using namespace std;

const int maxN = 200010;
int dp[maxN],M[maxN];
int t,n,a[maxN],ans;

int main(){
    Waifu(02)
    cin >> t;
    while(t--){
        cin >> n;
        for(int i=1;i<=n;i++)cin >> a[i];
        sort(a+1,a+n+1);
        for(int i=1;i<=n;i++){
            if(i<a[1])continue;
            dp[i] = M[i-a[i]]+1;
            M[i] = max(dp[i],M[i-1]);
        }
        cout << M[n] << endl;
        memset(dp,0,sizeof(dp));
        memset(M,0,sizeof(M));
    }
    return 0;
}


#include<bits/stdc++.h>
#define Waifu(my_waifu) ios::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define ll long long
#define Mod 1000000007
using namespace std;

const int maxN = 200013;
int dp[maxN],M[maxN];
int t,n,a[maxN],ans;

int main(){
    Waifu(02)
    cin >> t;
    while(t--){
        cin >> n;
        for(int i=1;i<=n;i++)cin >> a[i];
        sort(a+1,a+n+1);
        for(int i=1;i<=n;i++){
        	if(i<a[i])continue;
            dp[i] = max(dp[i-1],dp[i-a[i]]+1);
        }
        cout << dp[n] << endl;
        memset(M,0,n+10);
        memset(dp,0,n+10);
    }
    return 0;
}


#include<bits/stdc++.h>
#define Waifu(my_waifu) ios::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define ll long long
#define Mod 1000000007
using namespace std;

const int maxN = 200013;
int dp[maxN],M[maxN];
int t,n,a[maxN],ans;

int main(){
    Waifu(02)
    cin >> t;
    while(t--){
        cin >> n;
        for(int i=1;i<=n;i++)cin >> a[i];
        sort(a+1,a+n+1);
        for(int i=1;i<=n;i++){
        	if(i<a[i])continue;
            dp[i] = M[i-a[i]]+1;
            M[i] = max(dp[i],M[i-1]);
        }
        cout << M[n] << endl;
        memset(M,0,n+10);
        memset(dp,0,n+10);
    }
    return 0;
}


#include<bits/stdc++.h>
#define Waifu(my_waifu) ios::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define ll long long
#define Mod 1000000007
using namespace std;

const int maxN = 200010;
int dp[maxN],M[maxN];
int t,n,a[maxN],ans;

int main(){
    Waifu(02)
    cin >> t;
    while(t--){
        cin >> n;
        for(int i=1;i<=n;i++)cin >> a[i];
        sort(a+1,a+n+1);
        for(int i=a[1];i<=n;i++){
            dp[i] = M[i-a[i]]+1;
            M[i] = max(dp[i],M[i-1]);
        }
        cout << M[n] << endl;
    }
    return 0;
}


#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
void solve(){
    int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++) cin>>arr[i];
    sort(arr,arr+n);
    int count=0;
    int i=0;
    int length;
    while(i<n){
        length=arr[i];
        int index_of_last= i + length-1;
        if(arr[index_of_last]<=length) count++;
        i=index_of_last+1;
    }
    cout<<count<<endl;

}
int main(){
    IOS;
    int t;
    cin>>t;
    while(t--){
        solve();
    }
}


    #include<bits/stdc++.h>
    #define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    using namespace std;
    #define int long long
    void solve(){
        int n;
        cin>>n;
        int arr[n];
        for(int i=0;i<n;i++) cin>>arr[i];
        sort(arr,arr+n);
        int count=0;
        int i=0;
        int length;
        while(i<n){
            length=arr[i];
            int index_of_last= i + length-1;
            if(arr[index_of_last]<=length) count++;
            else{
                int temp=index_of_last+1;
                length+=1;
                while(arr[temp]>length && temp<n-1){
                    temp++;
                    length++;
                }
                if(temp==n){
                    cout<<count<<endl;
                    return ;
                }
                count++;
                index_of_last=temp;
            }
            i=index_of_last+1;
        }
        cout<<count<<endl;

    }
    int32_t main(){
        int t;
        cin>>t;
        while(t--){
            solve();
        }
    }


#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
#define int long long
void solve(){
    int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++) cin>>arr[i];
    sort(arr,arr+n);
    int count=0;
    int i=0;
    int length;
    while(i<n){
        length=arr[i];
        int index_of_last= i + length-1;
        if(arr[index_of_last]<=length) count++;
        i=index_of_last+1;
    }
    cout<<count<<endl;

}
int32_t main(){
    IOS;
    int t;
    cin>>t;
    while(t--){
        solve();
    }
}


#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
#define int long long
void solve(){
    int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++) cin>>arr[i];
    sort(arr,arr+n);
    int count=0;
    int i=0;
    int length;
    while(i<n){
        length=arr[i];
        int index_of_last= i + length-1;
        if(arr[index_of_last]<=length) count++;
        else{
            int temp=index_of_last+1;
            length+=1;
            while(arr[temp]>length && temp<n){
                temp++;
                length++;
            }
            if(temp==n){
                cout<<count<<endl;
                return ;
            }
            count++;
            index_of_last=temp;
        }
        i=index_of_last+1;
    }
    cout<<count<<endl;

}
int32_t main(){
    int t;
    cin>>t;
    while(t--){
        solve();
    }
}


    #include<bits/stdc++.h>
    #define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    using namespace std;
    #define int long long
    void solve(){
        int n;
        cin>>n;
        int arr[n];
        for(int i=0;i<n;i++) cin>>arr[i];
        sort(arr,arr+n);
        int count=0;
        int i=0;
        int length;
        while(i<n){
            length=arr[i];
            int index_of_last= i + length-1;
            if(arr[index_of_last]<=length) count++;
            else{
                int temp=index_of_last+1;
                length+=1;
                while(arr[temp]>length && temp<n-1){
                    temp++;
                    length++;
                }
                if(temp==n-1){
                    cout<<count<<endl;
                    return ;
                }
                count++;
                index_of_last=temp;
            }
            i=index_of_last+1;
        }
        cout<<count<<endl;

    }
    int32_t main(){
        int t;
        cin>>t;
        while(t--){
            solve();
        }
    }


#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
void solve(){
    int n;
    cin>>n;
    int arr[n+1]={0};
    for(int i=1;i<=n;i++) {
        int x;
        cin>>x;
        arr[x]++;
    }
    int count =0;
    for(int i=1;i<=n;i++){
        if(arr[i]>=i) count++;
    }
    cout<<count<<endl;

}
int main(){
    IOS;
    int t;
    cin>>t;
    while(t--){
        solve();
    }
}


    #include<bits/stdc++.h>
    #define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    using namespace std;
    #define int long long
    void solve(){
        int n;
        cin>>n;
        int arr[n];
        for(int i=0;i<n;i++) cin>>arr[i];
        sort(arr,arr+n);
        int count=0;
        int i=0;
        int length;
        while(i<n){
            length=1;
            while(length<arr[i]&&i<n-1){
                length++;
                i++;
            }
            if(arr[i]<=length){
                count++;
            }
        i++;
        }
        cout<<count<<endl;

    }
    int32_t main(){
        int t;
        cin>>t;
        while(t--){
            solve();
        }
    }


#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
#define int long long
void solve(){
    int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++) cin>>arr[i];
    sort(arr,arr+n);
    int count=0;
    int i=0;
    int length;
    while(i<n){
        length=arr[i];
        int index_of_last= i + length-1;
        if(arr[index_of_last]<=length) count++;
        i=index_of_last+1;
    }
    cout<<count<<endl;

}
int32_t main(){
    int t;
    cin>>t;
    while(t--){
        solve();
    }
}


#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ls rt<<1
#define rs rt<<1|1
#define fi first
#define se second
#define pb push_back
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const  ll inf  = 0x3f3f3f3f3f3f3f3f;
const int mod  = 998244353;
const int maxn = 2e6+6;;
const int N    = 1e3+5;
const double eps = 1e-6;
ll qpow(ll x,ll y){ll ans=1;x%=mod;while(y){ if(y&1) ans=ans*x%mod; x=x*x%mod; y>>=1;}return ans;}

int _,n,k,a[maxn],cnt[maxn];
int main(){

    for(scanf("%d",&_);_;_--){
        scanf("%d",&n);
        for(int i=1;i<=n;i++) cnt[a[i]]=0;
        for(int i=1;i<=n;i++){
            scanf("%d",&a[i]);
            cnt[a[i]]++;
        }
        sort(a+1,a+1+n);
        int ans=0,res=0;
        n=unique(a+1,a+1+n)-a-1;
        for(int i=1;i<=n;i++){
            int x=a[i];
            ans+=cnt[x]/x;
            res+=cnt[x]%x;
            ans+=res/x;
            res=res%x;
        }
        printf("%d\n",ans);
    }
}

/*

*/


#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ls rt<<1
#define rs rt<<1|1
#define fi first
#define se second
#define pb push_back
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const  ll inf  = 0x3f3f3f3f3f3f3f3f;
const int mod  = 998244353;
const int maxn = 2e6+4;
const int N    = 1e3+5;
const double eps = 1e-6;
ll qpow(ll x,ll y){ll ans=1;x%=mod;while(y){ if(y&1) ans=ans*x%mod; x=x*x%mod; y>>=1;}return ans;}

int _,n,k,a[maxn];
int main(){

    for(scanf("%d",&_);_;_--){
        scanf("%d",&n);
        for(int i=1;i<=n;i++) {
            scanf("%d",&a[i]);
        }
        sort(a+1,a+1+n);
        int ans=0,now=0;
        for(int i=1;i<=n;i++){
            now++;
            if(a[i]<=now){
                ans++;
                now=0;
            }
        }
        printf("%d\n",ans);
    }
}

/*

*/


#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ls rt<<1
#define rs rt<<1|1
#define fi first
#define se second
#define pb push_back
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const  ll inf  = 0x3f3f3f3f3f3f3f3f;
const int mod  = 998244353;
const int maxn = 2e6 + 6;
const int N    = 1e3+5;
const double eps = 1e-6;
ll qpow(ll x,ll y){ll ans=1;x%=mod;while(y){ if(y&1) ans=ans*x%mod; x=x*x%mod; y>>=1;}return ans;}

void dfs1(int u){
    dep[u]=dep[fa[u]]+1;
    sz[u]=1;
    for(int v:G[u]) if(v!=fa[u]){
        fa[v]=u;
        dfs1(v);
        sz[u]+=sz[v];
        if(sz[son[u]]<sz[v]) son[u]=v;
    }
}
void dfs2(int u){
    static int T;
    seq[pos[u]=++T]=u;
    if(son[fa[u]]==u) top[u]=top[fa[u]];
    else top[u]=u;
    if(son[u]) dfs(son[u]);
    for(int v:G[u]) if(v!=fa[u]&&v!=son[u]){
        dfs2(v);
    }
}
void update(int &rt,int ql,int val,int l,int r){
    if(rt==0) rt=++cnt;
    if(l==r) {sum[rt]+=val;return ;}
    int mid=l+r>>1;
    if(ql<=mid) update(ls[rt],ql,val,l,mid);
    else update(rs[rt],al,val,mid+1,r);
    sum[rt]=sum[ls[rt]]+sum[rs[rt]];
}
void upd(int x,int k,int val){
    for(;k<=1000000;k+=k&(-k)) {
        update(rt[k],x,val,2,n);///
    }
}

int que(int x,int y,int k){
    int ans=0;
    for(;k>0;k-=k&(-k)){
        ans+=askPath(2,x,y,k);
    }
    return ans;
}
int main(){
    scanf("%d%d",&n,&q);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    for(int i=1;i<n;i++){
        int u,v;scanf("%d%d",&u,&v);
        G[u].pb(v);G[v].pb(u);
    }
    dfs1(1);dfs2(1);
    for(int i=1;i<=n;i++){
        w[i]=__gcd(a[i],a[fa[i]]);
        if(i==son[fa[i]]) upd(pos[i],w[i],1);
    }
    while(q--){
        scanf("%d",&op);
        if(op==1){
            scanf("%d%d",&u,&x);
            /// fa[u]
            if(u==son[fa[u]]){
                upd(pos[u],w[u],-1);
                a[u]=x;
                w[u]=__gcd(a[u],a[fa[u]]);
                upd(pos[u],w[u],1);
            }

            if(son[u]){
                int v=son[u];
                upd(pos[v],-w[v]);
                a[v]=x;
                w[v]=__gcd(a[v],a[u]);
                upd(pos[v],w[v]);
            }
        }
        else {
            scanf("%d%d%d",&u,&v,&k);
            printf("%d\n",que(u,v,k));
        }
    }
}


#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ls rt<<1
#define rs rt<<1|1
#define fi first
#define se second
#define pb push_back
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const  ll inf  = 0x3f3f3f3f3f3f3f3f;
const int mod  = 998244353;
const int maxn = 1e4+4;
const int N    = 1e3+5;
const double eps = 1e-6;
ll qpow(ll x,ll y){ll ans=1;x%=mod;while(y){ if(y&1) ans=ans*x%mod; x=x*x%mod; y>>=1;}return ans;}

int _,n,k,a[maxn];
int main(){

    for(scanf("%d",&_);_;_--){
        scanf("%d%d",&n,&k);
        for(int i=1;i<=n;i++) {
            scanf("%d",&a[i]);
        }
        sort(a+1,a+1+n);
        int ans=0,now=0;
        for(int i=1;i<=n;i++){
            now++;
            if(a[i]>=now){
                ans++;
                now=0;
            }
        }
        printf("%d\n",ans);
    }

}

/*

*/


#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ls rt<<1
#define rs rt<<1|1
#define fi first
#define se second
#define pb push_back
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const  ll inf  = 0x3f3f3f3f3f3f3f3f;
const int mod  = 998244353;
const int maxn = 1e4+4;
const int N    = 1e3+5;
const double eps = 1e-6;
ll qpow(ll x,ll y){ll ans=1;x%=mod;while(y){ if(y&1) ans=ans*x%mod; x=x*x%mod; y>>=1;}return ans;}

int _,n,k,a[maxn];
int main(){

    for(scanf("%d",&_);_;_--){
        scanf("%d",&n);
        for(int i=1;i<=n;i++) {
            scanf("%d",&a[i]);
        }
        sort(a+1,a+1+n);
        int ans=0,now=0;
        for(int i=1;i<=n;i++){
            now++;
            if(a[i]<=now){
                ans++;
                now=0;
            }
        }
        printf("%d\n",ans);
    }
}

/*

*/


#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ls rt<<1
#define rs rt<<1|1
#define fi first
#define se second
#define pb push_back
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const  ll inf  = 0x3f3f3f3f3f3f3f3f;
const int mod  = 998244353;
const int maxn = 1e4+4;
const int N    = 1e3+5;
const double eps = 1e-6;
ll qpow(ll x,ll y){ll ans=1;x%=mod;while(y){ if(y&1) ans=ans*x%mod; x=x*x%mod; y>>=1;}return ans;}

int _,n,k,a[maxn],cnt[maxn];
int main(){

    for(scanf("%d",&_);_;_--){
        scanf("%d",&n);
        for(int i=1;i<=n;i++) cnt[a[i]]=0;
        for(int i=1;i<=n;i++){
            scanf("%d",&a[i]);
            cnt[a[i]]++;
        }
        sort(a+1,a+1+n);
        int ans=0,res=0;
        n=unique(a+1,a+1+n)-a-1;
        for(int i=1;i<=n;i++){
            int x=a[i];
            ans+=cnt[x]/x;
            res+=cnt[x]%x;
            ans+=res/x;
            res=res%x;
        }
        printf("%d\n",ans);
    }
}

/*

*/


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

using namespace std;

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

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

		sort( arr, arr+n );

		long long int j=n-1, count=0;
		while(j>=0){
			if( j - arr[j] >= -1 ){
				count++;
				j = j - arr[j];
			} else{
				j--;
			}
		}

		cout<<count<<endl;

	}

	return 0;
}


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

using namespace std;

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

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

		sort( arr, arr+n );

		unsigned long long int j=n-1, count=0;
		while(j>=0){
			if( j - arr[j] >= -1 ){
				count++;
				j = j - arr[j];
			} else{
				j--;
			}
		}

		cout<<count<<endl;

	}

	return 0;
}


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

using namespace std;

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

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

		sort( arr, arr+n );

		long long int i, j, dp[n], mx;

		for(i =0;i<n;i++){

			if( i - arr[i] >= 0)
				mx = dp[ i - arr[i] ] + 1;
			else if( i - arr[i] == -1 ) mx=1;
			else mx=0;

			if( i>0 && mx < dp[i-1]) mx=dp[i-1];

			dp[i] = mx;
		}

//		for(i =0;i<n;i++) cout<<dp[i]<<" ";

		cout<<dp[n-1]<<endl;

	}

	return 0;
}


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

using namespace std;

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

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

		sort( arr, arr+n );

		long long int i, j, dp[n], mx;

		for(i =0;i<n;i++){

			if( i - arr[i] >= 0)
				mx = dp[ i - arr[i] ] + 1;
			else if( i - arr[i] == -1 ) mx=1;
			else mx=0;

			for(j=0;j<i;j++){
				if(mx < dp[j]) mx=dp[j];
			}

			dp[i] = mx;
		}

//		for(i =0;i<n;i++) cout<<dp[i]<<" ";

		cout<<dp[n-1]<<endl;

	}

	return 0;
}


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

using namespace std;

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

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

		sort( arr, arr+n );

		int j=n-1, count=0;
		while(j>=0){
			if( j - arr[j] >= -1 ){
				count++;
				j = j - arr[j];
			} else{
				j--;
			}
		}

		cout<<count<<endl;

	}

	return 0;
}


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

using namespace std;

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

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

		sort( arr, arr+n );

		long long int j=n-1, count=0;
		while(j>=0){
			if( j - arr[j] >= -1 ){
				count++;
				j = j - arr[j];
			} else{
				j--;
			}
		}

		cout<<count<<endl;

	}

	return 0;
}


#include<bits/stdc++.h>

#define si(a) scanf("%d",&a)
#define sl(a) scanf("%lld",&a)
#define sd(a) scanf("%lf",&a)
#define sc(a) scahf("%c",&a);
#define ss(a) scanf("%s",a)
#define pi(a) printf("%d\n",a)
#define pl(a) printf("%lld\n",a)
#define pc(a) putchar(a)
#define ms(a) memset(a,0,sizeof(a))
#define repi(i, a, b) for(register int i=a;i<=b;++i)
#define repd(i, a, b) for(register int i=a;i>=b;--i)
#define reps(s) for(register int i=head[s];i;i=Next[i])
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define pii pair<int,int>
#define mii unordered_map<int,int>
#define msi unordered_map<string,int>
#define lowbit(x) ((x)&(-(x)))
#define ce(i, r) i==r?'\n':' '
#define pb push_back
#define fi first
#define se second
#define INF 0x3f3f3f3f
#define pr(x) cout<<#x<<": "<<x<<endl
using namespace std;

inline int qr() {
    int f = 0, fu = 1;
    char c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-')fu = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        f = (f << 3) + (f << 1) + c - 48;
        c = getchar();
    }
    return f * fu;
}
priority_queue<int>q;
int T,n;
int main(){
    T=qr();
    while(T--){
        n=qr();
        while(!q.empty())q.pop();
        while(n--)q.push(-qr());
        int ans=0;
        while(!q.empty()){
            int x=-q.top();q.pop();
            ans++;
            int now=1;
            bool suc=true;
            while(x>now){
                x=-q.top(),q.pop();
                now++;
                if(q.empty()&&x>now){
                    suc=false;
                    break;
                }
            }
            if(!suc){
                ans--;
                break;
            }
        }
        pi(ans);
    }
    return 0;
}


#include<bits/stdc++.h>

#define si(a) scanf("%d",&a)
#define sl(a) scanf("%lld",&a)
#define sd(a) scanf("%lf",&a)
#define sc(a) scahf("%c",&a);
#define ss(a) scanf("%s",a)
#define pi(a) printf("%d\n",a)
#define pl(a) printf("%lld\n",a)
#define pc(a) putchar(a)
#define ms(a) memset(a,0,sizeof(a))
#define repi(i, a, b) for(register int i=a;i<=b;++i)
#define repd(i, a, b) for(register int i=a;i>=b;--i)
#define reps(s) for(register int i=head[s];i;i=Next[i])
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define pii pair<int,int>
#define mii unordered_map<int,int>
#define msi unordered_map<string,int>
#define lowbit(x) ((x)&(-(x)))
#define ce(i, r) i==r?'\n':' '
#define pb push_back
#define fi first
#define se second
#define INF 0x3f3f3f3f
#define pr(x) cout<<#x<<": "<<x<<endl
using namespace std;

inline int qr() {
    int f = 0, fu = 1;
    char c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-')fu = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        f = (f << 3) + (f << 1) + c - 48;
        c = getchar();
    }
    return f * fu;
}
priority_queue<int>q;
int T,n;
int main(){
    T=qr();
    while(T--){
        n=qr();
        while(!q.empty())q.pop();
        while(n--)q.push(-qr());
        int ans=0;
        while(!q.empty()){
            int x=-q.top();q.pop();
            ans++;
            int now=1;
            bool suc=true;
            while(x>now){
                if(q.empty()){
                    suc=false;
                    break;
                }
                x=-q.top(),q.pop();
                now++;
            }
            if(!suc){
                ans--;
                break;
            }
        }
        pi(ans);
    }
    return 0;
}


#include<bits/stdc++.h>

#define si(a) scanf("%d",&a)
#define sl(a) scanf("%lld",&a)
#define sd(a) scanf("%lf",&a)
#define sc(a) scahf("%c",&a);
#define ss(a) scanf("%s",a)
#define pi(a) printf("%d\n",a)
#define pl(a) printf("%lld\n",a)
#define pc(a) putchar(a)
#define ms(a) memset(a,0,sizeof(a))
#define repi(i, a, b) for(register int i=a;i<=b;++i)
#define repd(i, a, b) for(register int i=a;i>=b;--i)
#define reps(s) for(register int i=head[s];i;i=Next[i])
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define pii pair<int,int>
#define mii unordered_map<int,int>
#define msi unordered_map<string,int>
#define lowbit(x) ((x)&(-(x)))
#define ce(i, r) i==r?'\n':' '
#define pb push_back
#define fi first
#define se second
#define INF 0x3f3f3f3f
#define pr(x) cout<<#x<<": "<<x<<endl
using namespace std;

inline int qr() {
    int f = 0, fu = 1;
    char c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-')fu = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        f = (f << 3) + (f << 1) + c - 48;
        c = getchar();
    }
    return f * fu;
}
priority_queue<int>q;
int T,n;
int main(){
    T=qr();
    while(T--){
        n=qr();
        while(n--)q.push(qr());
        int ans=0;
        while(!q.empty()){
            int x=q.top();q.pop();
            x--;
            ans++;
            if(q.size()<=x)break;
            while(x--)q.pop();
        }
        pi(ans);
    }
    return 0;
}


#include<bits/stdc++.h>

#define si(a) scanf("%d",&a)
#define sl(a) scanf("%lld",&a)
#define sd(a) scanf("%lf",&a)
#define sc(a) scahf("%c",&a);
#define ss(a) scanf("%s",a)
#define pi(a) printf("%d\n",a)
#define pl(a) printf("%lld\n",a)
#define pc(a) putchar(a)
#define ms(a) memset(a,0,sizeof(a))
#define repi(i, a, b) for(register int i=a;i<=b;++i)
#define repd(i, a, b) for(register int i=a;i>=b;--i)
#define reps(s) for(register int i=head[s];i;i=Next[i])
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define pii pair<int,int>
#define mii unordered_map<int,int>
#define msi unordered_map<string,int>
#define lowbit(x) ((x)&(-(x)))
#define ce(i, r) i==r?'\n':' '
#define pb push_back
#define fi first
#define se second
#define INF 0x3f3f3f3f
#define pr(x) cout<<#x<<": "<<x<<endl
using namespace std;

inline int qr() {
    int f = 0, fu = 1;
    char c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-')fu = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        f = (f << 3) + (f << 1) + c - 48;
        c = getchar();
    }
    return f * fu;
}
priority_queue<int>q;
int T,n;
int main(){
    T=qr();
    while(T--){
        n=qr();
        while(!q.empty())q.pop();
        while(n--)q.push(qr());
        int ans=0;
        while(!q.empty()){
            int x=q.top();q.pop();
            x--,ans++;
            if(q.size()<=x)break;
            while(x--)q.pop();
        }
        pi(ans);
    }
    return 0;
}


#include<bits/stdc++.h>

#define si(a) scanf("%d",&a)
#define sl(a) scanf("%lld",&a)
#define sd(a) scanf("%lf",&a)
#define sc(a) scahf("%c",&a);
#define ss(a) scanf("%s",a)
#define pi(a) printf("%d\n",a)
#define pl(a) printf("%lld\n",a)
#define pc(a) putchar(a)
#define ms(a) memset(a,0,sizeof(a))
#define repi(i, a, b) for(register int i=a;i<=b;++i)
#define repd(i, a, b) for(register int i=a;i>=b;--i)
#define reps(s) for(register int i=head[s];i;i=Next[i])
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define pii pair<int,int>
#define mii unordered_map<int,int>
#define msi unordered_map<string,int>
#define lowbit(x) ((x)&(-(x)))
#define ce(i, r) i==r?'\n':' '
#define pb push_back
#define fi first
#define se second
#define INF 0x3f3f3f3f
#define pr(x) cout<<#x<<": "<<x<<endl
using namespace std;

inline int qr() {
    int f = 0, fu = 1;
    char c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-')fu = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        f = (f << 3) + (f << 1) + c - 48;
        c = getchar();
    }
    return f * fu;
}
priority_queue<int>q;
int T,n;
int main(){
    T=qr();
    while(T--){
        n=qr();
        while(n--)q.push(qr());
        int ans=0;
        while(!q.empty()){
            int x=q.top();
            ans++;
            while(x--)q.pop();
        }
        pi(ans);
    }
    return 0;
}


#include<bits/stdc++.h>

#define si(a) scanf("%d",&a)
#define sl(a) scanf("%lld",&a)
#define sd(a) scanf("%lf",&a)
#define sc(a) scahf("%c",&a);
#define ss(a) scanf("%s",a)
#define pi(a) printf("%d\n",a)
#define pl(a) printf("%lld\n",a)
#define pc(a) putchar(a)
#define ms(a) memset(a,0,sizeof(a))
#define repi(i, a, b) for(register int i=a;i<=b;++i)
#define repd(i, a, b) for(register int i=a;i>=b;--i)
#define reps(s) for(register int i=head[s];i;i=Next[i])
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define pii pair<int,int>
#define mii unordered_map<int,int>
#define msi unordered_map<string,int>
#define lowbit(x) ((x)&(-(x)))
#define ce(i, r) i==r?'\n':' '
#define pb push_back
#define fi first
#define se second
#define INF 0x3f3f3f3f
#define pr(x) cout<<#x<<": "<<x<<endl
using namespace std;

inline int qr() {
    int f = 0, fu = 1;
    char c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-')fu = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        f = (f << 3) + (f << 1) + c - 48;
        c = getchar();
    }
    return f * fu;
}
priority_queue<int>q;
int T,n;
int main(){
    T=qr();
    while(T--){
        n=qr();
        while(n--)q.push(qr());
        int ans=0;
        while(!q.empty()){
            int x=q.top();
            ans++;
            if(q.size()<=x)break;
            while(x--)q.pop();
        }
        pi(ans);
    }
    return 0;
}


#include <iostream>
#include <string>
#include <bits/stdc++.h>
#include <map>
#include <math.h>
#include <vector>
#include <algorithm>
#include <set>
#include <list>

using namespace std;
#define ull unsigned long long

int main() {
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector<int> e(n);
        for (int i=0; i<n; i++) cin >> e[i];
        sort(e.begin(), e.end());
        int groups = 0;
        for (int i=0; i<n;) {
            groups ++;
            int groupsize = e[i];
            while (i+groupsize < n && e[i+groupsize] > groupsize) {
                groupsize ++;
            }
            //cout << i <<  " " << groupsize << endl;
            if (i+groupsize >= n) {
                break;
            }
            i += groupsize;
        }
        cout << groups << endl;
    }
}


#include <iostream>
#include <string>
#include <bits/stdc++.h>
#include <map>
#include <math.h>
#include <vector>
#include <algorithm>
#include <set>
#include <list>

using namespace std;
#define ull unsigned long long

int main() {
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector<int> e(n);
        for (int i=0; i<n; i++) cin >> e[i];
        sort(e.begin(), e.end());
        int groups = 0;
        int groupsize = 1;
        for (int i=0; i<n;) {
            if (i + groupsize <= n) {
                //cout << i << ' ' << groupsize << endl;
                if (e[i+groupsize-1] <= groupsize) {
                    groups ++;
                    i += groupsize;
                } else {
                    groupsize ++;
                }
            } else {
                break;
            }
        }
        cout << groups << endl;
    }
}


#include <iostream>
#include <string>
#include <bits/stdc++.h>
#include <map>
#include <math.h>
#include <vector>
#include <algorithm>
#include <set>
#include <list>

using namespace std;
#define ull unsigned long long

int main() {
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector<int> e(n);
        for (int i=0; i<n; i++) cin >> e[i];
        sort(e.begin(), e.end());
        int groups = 0;
        for (int i=0; i<n;) {
            int groupsize = e[i];
            while (i+groupsize < n && e[i+groupsize] > groupsize) {
                groupsize ++;
            }
            //cout << i <<  " " << groupsize << endl;
            if (groupsize >= n) {
                break;
            }
            groups ++;
            i += groupsize;
        }
        cout << groups << endl;
    }
}


#include <iostream>
#include <string>
#include <bits/stdc++.h>
#include <map>
#include <math.h>
#include <vector>
#include <algorithm>
#include <set>
#include <list>

using namespace std;
#define ull unsigned long long

int main() {
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector<int> e(n);
        for (int i=0; i<n; i++) cin >> e[i];
        sort(e.begin(), e.end());
        reverse(e.begin(), e.end());
        int groups = 0;
        for (int i=0; i<n;) {
            groups ++;
            i += e[i];
            //cout << i <<  " " << e[i] << endl;
        }
        cout << groups << endl;
    }
}


#include <iostream>
#include <string>
#include <bits/stdc++.h>
#include <map>
#include <math.h>
#include <vector>
#include <algorithm>
#include <set>
#include <list>

using namespace std;
#define ull unsigned long long

int main() {
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector<int> e(n);
        for (int i=0; i<n; i++) cin >> e[i];
        sort(e.begin(), e.end());
        int groups = 0;
        for (int i=0; i<n;) {
            groups ++;
            int groupsize = e[i];
            while (i+groupsize < n && e[i+groupsize] > groupsize) {
                groupsize ++;
            }
            //cout << i <<  " " << groupsize << endl;
            if (groupsize >= n) {
                break;
            }
            i += groupsize;
        }
        cout << groups << endl;
    }
}


#include <iostream>
#include <string>
#include <bits/stdc++.h>
#include <map>
#include <math.h>
#include <vector>
#include <algorithm>
#include <set>
#include <list>

using namespace std;
#define ull unsigned long long

int main() {
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector<int> e(n);
        for (int i=0; i<n; i++) cin >> e[i];
        sort(e.begin(), e.end());
        int groups = 0;
        for (int i=0; i<n;) {
            int groupsize = e[i];
            while (i+groupsize < n && e[i+groupsize] > groupsize) {
                groupsize ++;
            }
            //cout << i <<  " " << groupsize << endl;
            if (groupsize > n) {
                break;
            }
            groups ++;
            i += groupsize;
        }
        cout << groups << endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+10;
int a[maxn];
int vis[maxn];
int main()
{
    int T;
    scanf("%d",&T);
    while(T--){
        memset(vis,0,sizeof(vis));
        int n;
        scanf("%d",&n);
        int mx=0;
        for(int i=1;i<=n;i++){
            scanf("%d",&a[i]);
            vis[a[i]]++;
        }
        unique(a+1,a+1+n);
        sort(a+1,a+1+n);
        ll ans=0;
        ll limit=0;
        for(int i=1;i<=n;i++){
            ans+=vis[a[i]]/a[i];
            vis[a[i+1]]+=vis[a[i]]%a[i];
            vis[a[i]]=0;
        }
        printf("%lld\n",ans);
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+10;
int a[maxn];
int vis[maxn];
int main()
{
    int T;
    scanf("%d",&T);
    while(T--){
        memset(vis,0,sizeof(vis));
        int n;
        scanf("%d",&n);
        int mx=0;
        for(int i=1;i<=n;i++){
            scanf("%d",&a[i]);
            vis[a[i]]++;
        }
        sort(a+1,a+1+n);
        ll ans=0;
        ll limit=0;
        for(int i=1;i<=n;i++){
            ans+=vis[a[i]]/a[i];
            vis[a[i+1]]+=vis[a[i]]%a[i];
        }
        printf("%lld\n",ans);
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+10;
int a[maxn];
int vis[maxn];
int main()
{
    int T;
    scanf("%d",&T);
    while(T--){
        memset(vis,0,sizeof(vis));
        int n;
        scanf("%d",&n);
        for(int i=1;i<=n;i++){
            scanf("%d",&a[i]);
            vis[a[i]]++;
        }
        ll ans=0;
        ll limit=0;
        for(int i=1;i<=maxn-10;i++){
            ans+=vis[i]/i;
            limit=vis[i]%i;
            vis[i+1]+=limit;
        }
        printf("%lld\n",ans);
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+10;
int a[maxn];
int vis[maxn];
int main()
{
    int T;
    scanf("%d",&T);
    while(T--){
        memset(vis,0,sizeof(vis));
        int n;
        scanf("%d",&n);
        int mx=0;
        for(int i=1;i<=n;i++){
            scanf("%d",&a[i]);
            vis[a[i]]++;
        }
        sort(a+1,a+1+n);
        ll ans=0;
        ll limit=0;
        for(int i=1;i<=n;i++){
            ans+=vis[a[i]]/a[i];
            vis[a[i+1]]+=vis[a[i]]%a[i];
            vis[a[i]]=0;
        }
        printf("%lld\n",ans);
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+10;
int a[maxn];
int vis[maxn];
int main()
{
    int T;
    scanf("%d",&T);
    while(T--){
        memset(vis,0,sizeof(vis));
        int n;
        scanf("%d",&n);
        for(int i=1;i<=n;i++){
            scanf("%d",&a[i]);
            vis[a[i]]++;
        }
        ll ans=0;
        for(int i=1;i<=maxn-10;i++){
            ans+=vis[i]/i;
        }
        printf("%lld\n",ans);
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+10;
int a[maxn];
int vis[maxn];
int main()
{
    int T;
    scanf("%d",&T);
    while(T--){
        memset(vis,0,sizeof(vis));
        int n;
        scanf("%d",&n);
        int mx=0;
        for(int i=1;i<=n;i++){
            scanf("%d",&a[i]);
            vis[a[i]]++;
        }
        sort(a+1,a+1+n);
        ll ans=0;
        ll limit=0;
        for(int i=1;i<=n;i++){
            ans+=vis[a[i]]/a[i];
            vis[a[i]]=0;
            vis[a[i+1]]+=vis[a[i]]%a[i];
        }
        printf("%lld\n",ans);
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+10;
int a[maxn];
int vis[maxn];
int sto[maxn];
int main()
{
    int T;
    scanf("%d",&T);
    while(T--){
       // memset(vis,0,sizeof(vis));
        int n;
        scanf("%d",&n);
        int mx=0;
        int num=0;
        for(int i=1;i<=n;i++){
            scanf("%d",&a[i]);
            vis[a[i]]++;
            if(vis[a[i]]==1){
                sto[++num]=a[i];
            }
        }
        sort(sto+1,sto+1+num);
        ll ans=0;
        ll limit=0;
        for(int i=1;i<=num;i++){
            ans+=vis[sto[i]]/sto[i];
            vis[sto[i+1]]+=vis[sto[i]]%sto[i];
            vis[sto[i]]=0;
        }
        vis[sto[num+1]]=0;
        printf("%lld\n",ans);
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+10;
int a[maxn];
int vis[maxn];
int sto[maxn];
int main()
{
    int T;
    scanf("%d",&T);
    while(T--){
        memset(vis,0,sizeof(vis));
        int n;
        scanf("%d",&n);
        int mx=0;
        int num=0;
        for(int i=1;i<=n;i++){
            scanf("%d",&a[i]);
            vis[a[i]]++;
            if(vis[a[i]]==1){
                sto[++num]=a[i];
            }
        }
        sort(sto+1,sto+1+num);
        ll ans=0;
        ll limit=0;
        for(int i=1;i<=num;i++){
            ans+=vis[sto[i]]/sto[i];
            vis[sto[i+1]]+=vis[sto[i]]%sto[i];
            vis[sto[i]]=0;
        }
        printf("%lld\n",ans);
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+10;
int a[maxn];
int vis[maxn];
int main()
{
    int T;
    scanf("%d",&T);
    while(T--){
        memset(vis,0,sizeof(vis));
        int n;
        scanf("%d",&n);
        int mx=0;
        for(int i=1;i<=n;i++){
            scanf("%d",&a[i]);
            mx=max(mx,a[i]);
            vis[a[i]]++;
        }
        ll ans=0;
        ll limit=0;
        for(int i=1;i<=mx;i++){
            ans+=vis[i]/i;
            limit=vis[i]%i;
            vis[i+1]+=limit;
        }
        printf("%lld\n",ans);
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int k[1001];
int main(){
	int t;
	cin>>t;
	while(t--){
		int n,i,c=0,s=0;
		cin>>n;
		for(i=1;i<=n;i++)
			cin>>k[i];
		sort(k+1,k+n+1);
		for(i=1;i<=n;i++){
			c++;
			if(c==k[i]){
				s++;
				c=0;
			}
		}
		cout<<s<<endl;
	}
}


#include <bits/stdc++.h>
#define int int
using namespace std;
void wk();
signed main(){int test=1;scanf("%d",&test);
while(test--)wk();}
const int N = 1005000;
int e[N], n;
void wk(){
  cin>>n;
  for(int i=1;i<=n;++i)cin>>e[i];
  sort(e+1,e+n+1);
  int ans=0,now=0, num=0;
  for (int i = 1;i<=n;++i)
  {
    ++num;
    now=max(now, e[i]);
    if(now<=num) {
      num=now=0;
      ++ans;
    }
  }
  cout<<ans<<endl;
}


#include<bits/stdc++.h>
using namespace std;
int dp[200010],e[200010];
int cnt,ans,n;
int main()
{
	cin>>cnt;
	while(cnt--)
	{
		cin>>n;
		for(int i=1;i<=n;i++)
		    cin>>e[i];
		sort(e+1,e+n+1);
		ans=0;
		for(int i=1;i<=n;i++)
		{
			dp[i]=dp[i-1];
			if(i>=e[i]) dp[i]=max(dp[i],dp[i-e[i]]+1);
			ans=max(ans,dp[i]);
		}
		cout<<ans<<endl;
		for(int i=1;i<=n;i++)
		    dp[i]=0;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int t,n,a[200010];
int main(){
	cin>>t;
	for(int q=1;q<=t;q++){
		cin>>n;
		for(int i=1;i<=n;i++) cin>>a[i];
		sort(a+1,a+1+n);
		int s=0,x=0;
		for(int i=1;i<=n;i++){
			x++;
			if(x>=a[i]){
				s++;
				x-=a[i];
			}
		}
		cout<<s<<endl;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define re register
inline int read(){
	re int t=0;re char v=getchar();
	while(v<'0')v=getchar();
	while(v>='0')t=(t<<3)+(t<<1)+v-48,v=getchar();
	return t;
}
int n,m,t,ans,a[1000002],dp[1000002];
int main(){
	t=read();
	while(t--){
		n=read();
		for(re int i=1;i<=n;++i)a[i]=read();
		sort(a+1,a+n+1);ans=0;
		for(re int i=1;i<=n;++i){
		dp[i]=dp[i-1];		if(i>=a[i])dp[i]=max(dp[i],dp[i-a[i]]+1);ans=max(ans,dp[i]);}
		printf("%d\n",ans);
		for(re int i=1;i<=n;++i)dp[i]=0;
	}
}


#include<bits/stdc++.h>
using namespace std;
int k[200001];
int main(){
	int t;
	cin>>t;
	while(t--){
		int n,i,j,c=0,s=0;
		cin>>n;
		for(i=1;i<=n;i++)
			cin>>k[i];
		sort(k+1,k+n+1);
		for(i=1;i<=n;i++){
			c++;
			if(c==k[i]){
				c=0;
				s++;
			}
		}
		cout<<s<<endl;
	}
}


#include <bits/stdc++.h>
using namespace std;
int n,a[200005];
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        cin>>n;
        int i;
        for(i=1;i<=n;i++)scanf("%d",&a[i]);
        sort(a+1,a+n+1);
        int ans=0;
        int cnt=0;
        a[n+1]=0x3f3f3f3f;
        for(i=1;i<=n+1;i++)
        {
            cnt++;
            if(a[i]==cnt)
            {
                ans++;
                cnt=0;
            }
        }
        cout<<ans<<endl;
    }

}


#include<bits/stdc++.h>
using namespace std;
int k[200001];
int main(){
	int t;
	cin>>t;
	while(t--){
		int n,i,c=0,s=0;
		cin>>n;
		for(i=1;i<=n;i++)
			cin>>k[i];
		sort(k+1,k+n+1);
		for(i=1;i<=n;i++){
			c++;
			if(c==k[i]){
				s++;
				c=0;
			}
		}
		cout<<s<<endl;
	}
}


#include<bits/stdc++.h>
using namespace std;
int T,a[200003],n;
int main(){
	cin>>T;while(T--){
		cin>>n;
		for(int i=0;i<n;i++)scanf("%d",a+i);
		sort(a,a+n);int cnt=0;
		for(int i=0,j=0;i<n;i++){
			j++;
			if(a[i]<=j)cnt++,j=0;
		}
		cout<<cnt<<endl;
	}
}


#include<iostream>
using namespace std;
const int N=200005;
int t,n;
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	cin>>t;
	while(t--){
		int a[N]={},e[N]={},ans=0,tmp=0;
		cin>>n;
		for(int i=1;i<=n;i++){
			cin>>a[i];
			e[a[i]]++;
		}
		for(int i=1;i<=n;i++){
			ans+=(e[i]+tmp)/i;
			tmp=(e[i]+tmp)%i;
		}
		cout<<ans<<endl;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int k[200001],vis[200001];
int main(){
	int t;
	cin>>t;
	while(t--){
		memset(vis,0,sizeof(vis));
		int n,i,c=0,s=0,z=1;
		cin>>n;
		for(i=1;i<=n;i++)
			cin>>k[i];
		sort(k+1,k+n+1);
		for(i=1;i<=n;i++){
			if(!vis[k[i]])c++;
			vis[k[i]]=1;
			if(c==k[z]){
				c=0;
				s++;
				z=i+1;
			}
		}
		cout<<s<<endl;
	}
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i,a,b) for(int i=a;i<=b;i++)
inline ll r() {
	ll x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9')c=getchar();
	if(c=='-')f=-1,c=getchar();
	while(isdigit(c))x=x*10+c-'0',c=getchar();
	return x*f;
}
#define d r()
ll t;
ll n;
ll a[1000010];
ll sum[200010];
int main(){
	t=d;
	while(t--){
		n=d;
		ll all=0,k=0;
		f(i,1,n)sum[i]=0;
		f(i,1,n)a[i]=d,sum[a[i]]++,all+=a[i];
		ll ans=0;
		f(i,1,n)ans+=sum[i]/i,sum[i]%=i;
		f(i,1,n){
			k+=sum[i];
			if(k>=i)k-=i,ans++;
		}
		printf("%lld\n",ans);
	}
	return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;

int main() {
    int t,n;
    cin >> t;
    for (; t ; --t) {
        cin >> n;
        int p, experience[n], groups = 0;
        for (int i = 0; i < n; ++i) {
            cin >> experience[i];
        }
        sort(experience, experience+n);
        for (p = 0; p < n; p++) {
            int maxE = experience[p], i;
            for (i = p; i < n; ++i) {
                maxE = max(maxE, experience[i]);
                if (i - p + 1 >= maxE) {
                    groups++;
                    break;
                }
            }
            p = i;
        }
        cout << groups << endl;
    }
    return 0;
}


#include <bits/stdc++.h>
#define re register
#define SIZE 300005
using namespace std;
int t;
int n,a[SIZE];
int dp[SIZE];
int main()
{
	scanf("%d",&t);
	for(re int i=1;i<=t;++i)
	{
		scanf("%d",&n);
		for(re int j=1;j<=n;++j)
			scanf("%d",&a[j]);
		sort(a+1,a+n+1);
		dp[0]=0;
		for(re int j=1;j<=n;++j)
			if(j-a[j]>=0)
				dp[j]=max(dp[j-1],dp[j-a[j]]+1);
			else
				dp[j]=dp[j-1];
		printf("%d\n",dp[n]);
	}
	return 0;
}


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

int main()
{
    long long t;
    cin>>t;
    for(long long i=0;i<t;i++)
    {
        long long n,group=0,count=0;
        cin>>n;
        vector<long long>v;
        for(long long j=0;j<n;j++)
        {
            long long num;
            cin>>num;
            v.push_back(num);
        }
        sort(v.begin(),v.end());

        for(long long j=0;j<n;j++)
        {
            long long max=v[j];
            count++;
            if(v[j]==max && count==max)
            {
                count=0;
                group++;
            }
        }
        cout<<group<<endl;
    }
}


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

int main()
{
    long long t;
    cin>>t;
    for(long long i=0;i<t;i++)
    {
        long long n,group=0,count=0;
        cin>>n;
        vector<long long>v;
        for(long long j=0;j<n;j++)
        {
            long long num;
            cin>>num;
            v.push_back(num);
        }
        sort(v.begin(),v.end());
        max=v[0];
        for(long long j=0;j<n;j++)
        {
            int max=v[j];
            count++;
            if(v[j]==max && count==max)
            {
                count=0;
                group++;
            }
        }
        cout<<group<<endl;
    }
}


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

int main()
{
    long long t;
    cin>>t;
    for(long long i=0;i<t;i++)
    {
        long long n,group=0,count=0;
        cin>>n;
        vector<long long>v;
        for(long long j=0;j<n;j++)
        {
            long long num;
            cin>>num;
            v.push_back(num);
        }
        sort(v.begin(),v.end());
        max=v[0];
        for(long long j=0;j<n;j++)
        {
            max=v[j];
            count++;
            if(v[j]==max && count==max)
            {
                count=0;
                group++;
            }
        }
        cout<<group<<endl;
    }
}


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

int main()
{
    long long t;
    cin>>t;
    for(long long i=0;i<t;i++)
    {
        long long n,group=0;
        cin>>n;
        vector<long long>v;
        for(long long j=0;j<n;j++)
        {
            long long num;
            cin>>num;
            v.push_back(num);
        }
        sort(v.begin(),v.end());
        for(long long j=0;j<n;j++)
        {
            if(v[j]==v[j+v[j]-1)
            {
                group++;
                j=j+v[j]-1;
            }
        }
        cout<<group<<endl;
    }
}


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

int main()
{
    long long t;
    cin>>t;
    for(long long i=0;i<t;i++)
    {
        long long n,group=0,count=0;
        cin>>n;
        vector<long long>v;
        for(long long j=0;j<n;j++)
        {
            long long num;
            cin>>num;
            v.push_back(num);
        }
        sort(v.begin(),v.end());
        max=v[0];
        for(long long j=0;j<n;j++)
        {
            long long max=v[j];
            count++;
            if(v[j]==max && count==max)
            {
                count=0;
                group++;
            }
        }
        cout<<group<<endl;
    }
}


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

int main()
{
    long long t;
    cin>>t;
    for(long long i=0;i<t;i++)
    {
        long long n,group=0;
        cin>>n;
        vector<long long>v;
        for(long long j=0;j<n;j++)
        {
            long long num;
            cin>>num;
            v.push_back(num);
        }
        sort(v.begin(),v.end());
        for(long long j=0;j<n;j++)
        {
            if(v[j]==v[j+v[j]-1] && (j+v[j]-1)<n)
            {
                group++;
                j=j+v[j]-1;
            }
        }
        cout<<group<<endl;
    }
}


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

int main()
{
    long long t;
    cin>>t;
    for(long long i=0;i<y=t;i++)
    {
        long long n,group=0;
        cin>>n;
        vector<long long>v;
        for(long long j=0;j<n;j++)
        {
            long long num;
            cin>>num;
            v.push_back(num);
        }
        sort(v.begin(),v.end());
        for(long long j=0;j<n;j++)
        {
            if(v[j]==v[j+v[j]-1)
            {
                group++;
                j=j+v[j]-1;
            }
        }
        cout<<group<<endl;
    }
}


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

int main()
{
    long long t;
    cin>>t;
    for(long long i=0;i<t;i++)
    {
        long long n,group=0;
        cin>>n;
        vector<long long>v;
        for(long long j=0;j<n;j++)
        {
            long long num;
            cin>>num;
            v.push_back(num);
        }
        sort(v.begin(),v.end());
        for(long long j=0;j<n;j++)
        {
            if(v[j]==v[j+v[j]-1])
            {
                group++;
                j=j+v[j]-1;
            }
        }
        cout<<group<<endl;
    }
}


#include <bits/stdc++.h>

using namespace std;
const int maxn = 3e5 + 7;
int n, a[maxn], cnt[maxn];
int main() {
    int t;
    scanf("%d", &t);
    while(t--) {
        scanf("%d", &n);
        for(int i = 1; i <= n; ++i) cnt[i] = 0;
        for(int i = 1; i <= n; ++i) {
            scanf("%d", a + i);
            cnt[a[i]]++;
        }
        int ans = 0;
        for(int i = 1; i <= n; ++i){
            ans += cnt[i] / i;
            cnt[i + 1] += cnt[i] % i;
        }
        printf("%d\n", ans);
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
const int maxn = 3e5 + 7;
int n, a[maxn], cnt[maxn];
int main() {
    int t;
    scanf("%d", &t);
    while(t--) {
        scanf("%d", &n);
        for(int i = 1; i <= n; ++i) cnt[i] = 0;
        for(int i = 1; i <= n; ++i) {
            scanf("%d", a + i);
            cnt[a[i]]++;
        }
        int ans = 0;
        for(int i = 1; i <= n; ++i) ans += cnt[i] / i;
        printf("%d\n", ans);
    }
    return 0;
}


get = lambda: map(int, raw_input().split())
n, m = get()

x = [0] * n
c = [1, 2, 3]
for i in range(m):
    d = map(lambda x: x - 1, get())
    taken = set()
    taken.add(x[v]) for v in d if x[v] != 0
    for v in d:
        if x[v] == 0:
            for e in c:
                if not e in taken:
                    taken.add(e)
                    x[v] = e
                    break

print ' '.join(map(str, x))


R=lambda:map(int,raw_input().split())
n,m=R()
c=[0]*(n+1)
for i in range(m):
  a=R()
  b=15
  for d in a:b^=1<<c[d]
  b=[x for x in (1,2,3) if (1<<x)&b]
  for d in a:
    if not c[d]:
      c[d]=b.pop()
print ' '.join(map(str,c[1:]))


def main():
	n, m = map(int, raw_input().split())
	ans = [0] * (n + 1)
	for i in xrange(m):
		a = map(int, raw_input().split())
		x = [1, 2, 3]
		for j in xrange(3):
			if ans[a[j]] != 0: del x[ans[a[j]] - 1]
		for j in xrange(3):
			if 0 == ans[a[j]]:
				ans[a[j]] = x[-1]
				del x[-1]
	print " ".join(map(str, ans[1:]))

if __name__ == "__main__": main()


/*  AUTHOR:AKASH JAIN
*   USERNAME:akash19jain
*   DATE:16/10/2019
*/
// #include<algorithm>
// #include <bits/stdc++.h>
// using namespace std;

#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<ctype.h>
#define SC1(x)          scanf("%lld",&x)
#define SC2(x,y)        scanf("%lld%lld",&x,&y)
#define SC3(x,y,z)      scanf("%lld%lld%lld",&x,&y,&z)
#define SCS(x)          scanf("\n%s", x)
#define PF1(x)          printf("%lld\n",x)
#define PF2(x,y)        printf("%lld %lld\n",x,y)
#define PF3(x,y,z)      printf("%lld %lld %lld\n",x,y,z)
#define PFN                printf("\n")
#define REP(i,n)        for(long long i=0;i<(n);i++)
#define FOR(i,a,b)      for(long long i=(a);i<=(b);i++)
#define FORD(i,a,b)     for(long long i=(a);i>=(b);i--)
#define WHILE(n)        while(n--)
#define MEM(a, b)       memset(a, (b), sizeof(a))
#define ITOC(c)         ((char)(((ll)'0')+c))
#define MID(s,e)        (s+(e-s)/2)
#define SZ(a)            strlen(a)
#define MOD             1000000007
#define MAX             10000000005
#define MIN             -10000000005
#define PI              3.1415926535897932384626433832795
#define DEB(x)          printf("The value of \"%s\" is: %d\n",#x,x)
#define CASES           ll t;SC1(t);while(t--)
#define ABS(a)          ((a>0)?a:-(a))
#define SWAP(a,b)        ll z=a;a=b;b=z
#define SWAPC(a,b)        char z=a;a=b;b=z

const int INF = 1<<29;
typedef long long ll;
typedef unsigned long long ull;
#define FILEIO(name) \  freopen(name".in", "r", stdin); \   freopen(name".out", "w", stdout);
int cmp(const void * a,const void * b);
long long maxv(long long a,long long b);
long long minv(long long a,long long b);
long long gcd(long long u,long long v);
long long digits(long long n);
bool isPoweroftwo(long long n);

int main()
{
    ll n,m;
    SC2(n,m);
    ll arr[n+1];
    MEM(arr,0);
    ll a,b,c,current=1;
    while(m--)
    {
        SC3(a,b,c);
        if(arr[a]==0 && arr[b]==0 && arr[c]==0)
        {
            arr[a]=1;
            arr[b]=2;
            arr[c]=3;
        }
        else if(arr[a]==0 && arr[b]==0)
        {
            if(arr[c]==1)
            {
                arr[a]=2;arr[b]=3;
            }
            if(arr[c]==2)
            {
                arr[a]=1;arr[b]=3;
            }
            if(arr[c]==3)
            {
                arr[a]=2;arr[b]=1;
            }
        }
        else if(arr[b]==0 && arr[c]==0)
        {
            if(arr[a]==1)
            {
                arr[c]=2;arr[b]=3;
            }
            if(arr[a]==2)
            {
                arr[c]=1;arr[b]=3;
            }
            if(arr[a]==3)
            {
                arr[c]=2;arr[b]=1;
            }
        }
        else if(arr[a]==0 && arr[c]==0)
        {
            if(arr[b]==1)
            {
                arr[a]=2;arr[c]=3;
            }
            if(arr[b]==2)
            {
                arr[a]=1;arr[c]=3;
            }
            if(arr[b]==3)
            {
                arr[a]=2;arr[c]=1;
            }
        }
    }
    REP(i,n)
        printf("%lld ",arr[i+1]);
    return 0;
}

//qsort(arr,n,sizeof(arr[0]),cmp);
int cmp (const void * a, const void * b)
{
    if( *(ll*)a - *(ll*)b < 0 ) return -1;
    if( *(ll*)a - *(ll*)b > 0 ) return 1;
        return 0;
}
long long maxv(long long a,long long b)
{
    if(a>b) return a;
        return b;
}
long long minv(long long a,long long b)
{
    if(a<b) return a;
        return b;
}
long long gcd(long long u,long long v)
{
    if (v == 0) return u;
       return gcd(v, u%v);
}
long long digits(long long n)    //to calculate no of digits in a number
{
    return floor(log10(n))+1;
}
bool isPoweroftwo(long long x)
{
    return x && (!(x&(x-1)));
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define maxLength 100001

int colour[maxLength];

int main() {

    int n, m;
    scanf("%d %d", &n, &m);
    int vect1[n], vect2[n], vect3[n];

    for(int i = 0; i < m; i++) {

        scanf("%d %d %d", &vect1[i], &vect2[i], &vect3[i]);

    }

    int white = 1, red = 1, blue = 1;
    for(int i = 0; i < m; i++) {

        white = 1, red = 1, blue = 1;

        if(colour[vect1[i]] == 0 && colour[vect2[i]] == 0 && colour[vect3[i]] == 0) {

            colour[vect1[i]] = 1;
            colour[vect2[i]] = 2;
            colour[vect3[i]] = 3;
            continue;

        }

        if(colour[vect1[i]] == 1 || colour[vect2[i]] == 1 || colour[vect3[i]] == 1)
            white = -1;

        if(colour[vect1[i]] == 2 || colour[vect2[i]] == 2 || colour[vect3[i]] == 2)
            red = -1;

        if(colour[vect1[i]] == 3 || colour[vect2[i]] == 3 || colour[vect3[i]] == 3)
            blue = -1;

        if(white == -1) {

            if(colour[vect1[i]] == 1) {

                colour[vect2[i]] = 2;
                colour[vect3[i]] = 3;

            } else if(colour[vect2[i]] == 1) {

                colour[vect1[i]] = 2;
                colour[vect3[i]] = 3;

            } else {

                colour[vect1[i]] = 2;
                colour[vect2[i]] = 3;

            }

        } else if(red == -1) {

            if(colour[vect1[i]] == 2) {

                colour[vect2[i]] = 1;
                colour[vect3[i]] = 3;

            } else if(colour[vect2[i]] == 2) {

                colour[vect1[i]] = 1;
                colour[vect3[i]] = 3;

            } else {

                colour[vect1[i]] = 1;
                colour[vect2[i]] = 3;

            }

        } else {

            if(colour[vect1[i]] == 3) {

                colour[vect2[i]] = 1;
                colour[vect3[i]] = 2;

            } else if(colour[vect2[i]] == 3) {

                colour[vect1[i]] = 1;
                colour[vect3[i]] = 2;

            } else {

                colour[vect1[i]] = 1;
                colour[vect2[i]] = 2;

            }
        }
    }

    for(int i = 1 ; i <= n; i++)
        printf("%d ", colour[i]);
    return 0;
}


#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <time.h>
#include <stdbool.h>
// const int dx[] = {0, 1, 0, -1};
// const int dy[] = {1, 0, -1, 0};
// const int dx[] = {-1, -1, -1, 0, 0, 1, 1, 1};
// const int dy[] = {-1, 0, 1, -1, 1, -1, 0, 1};
// const int dx[] = {2, 2, -2, -2, 1, 1, -1, -1};
// const int dy[] = {-1, 1, 1, -1, 2, -2, 2, -2};
#define pf printf
#define sf scanf
#define fr(i,a,b) for((i)=(a);i<(int)(b);(i)++)
#define frr(i,a,b) for((i)=(a);i>=(int)(b);(i)--)
#define ln puts("")
#define mems(a) memset((a),0,sizeof(a))
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
ll on_bit(ll x, int pos) {x |= (1LL << pos); return x;}
int off_bit(int x, int pos) {x &= ~(1 << pos); return x;}
bool is_on_bit(ll x, int pos) {return ((x & (1LL << pos)) != 0);}
int flip_bit(int x, int pos) {x ^= (1 << pos); return x;}
int lsb(int x) {return x & (-x);}
int on_bit_all(int x, int pos) {x = (1 << pos)-1; return x;}
const double EPS = 1e-9;
const double PI = 2*acos(0.0);
const int INF = 0x3f3f3f3f;
const ll LLINF = 1e18;
const int MOD = 1e9+7;
int add(ll a, ll b){return ((a%MOD)+(b%MOD))%MOD;}
int sub(ll a, ll b){return ((a%MOD)-(b%MOD))%MOD;}
int mult(ll a, ll b){return ((a%MOD)*(b%MOD))%MOD;}
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
//qsort,strrev,strcat

#define N 123456
int a[N];
int b[N];
int c[N];
int color[N];

int main(){
	int n,m,i;
	sf("%d%d",&n,&m);
	mems(color);
	fr(i,0,m)sf("%d%d%d",a+i,b+i,c+i);
	fr(i,0,m){
		int ok1=1,ok2=1,ok3=1;
		if(color[a[i]]){
			if(color[a[i]]==1)ok1=0;
			if(color[a[i]]==2)ok2=0;
			if(color[a[i]]==3)ok3=0;
		}
		if(color[b[i]]){
			if(color[b[i]]==1)ok1=0;
			if(color[b[i]]==2)ok2=0;
			if(color[b[i]]==3)ok3=0;
		}
		if(color[c[i]]){
			if(color[c[i]]==1)ok1=0;
			if(color[c[i]]==2)ok2=0;
			if(color[c[i]]==3)ok3=0;
		}
		if(!color[a[i]]){
			if(ok1){color[a[i]]=1;ok1=0;}
			else if(ok2){color[a[i]]=2;ok2=0;}
			else {color[a[i]]=3;ok3=0;}
		}
		if(!color[b[i]]){
			if(ok1){color[b[i]]=1;ok1=0;}
			else if(ok2){color[b[i]]=2;ok2=0;}
			else {color[b[i]]=3;ok3=0;}
		}
		if(!color[c[i]]){
			if(ok1){color[c[i]]=1;ok1=0;}
			else if(ok2){color[c[i]]=2;ok2=0;}
			else {color[c[i]]=3;ok3=0;}
		}
	}
	fr(i,1,n+1){
		if(i>1)pf(" ");
		pf("%d",color[i]);
	}ln;
	return 0;
}


using System;
using System.IO;
using System.Collections.Generic;
using System.Numerics;

namespace cf207
{
    class Program
    {
        static void Main(string[] args)
        {
            //Console.SetIn(new StreamReader("input.txt"));
            solve_cf207B();
        }

        public static void solve_cf207B()
        {
            int[] nm = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int n = nm[0];
            int m = nm[1];
            Queue<KeyValuePair<char, int>> rep = new Queue<KeyValuePair<char, int>>();

            Dictionary<char, int> dic = new Dictionary<char, int>();
            for (int i = 0; i < m; i++)
            {
                string[] row = Console.ReadLine().Split(' ');

                for (int j = 0; j < row.Length; j++)
                {
                    if (dic.ContainsKey(row[j][0]))
                    {
                        dic[row[j][0]]++;
                    }
                    else
                    {
                        dic.Add(row[j][0], 1);
                    }
                }
            }
            int k = 0;
            foreach(KeyValuePair<char, int> pair in dic)
            {
                if (pair.Value == 2)
                {
                    rep.Enqueue(new KeyValuePair<char, int>(pair.Key, (k % 3) + 1));
                    k++;
                }
            }

            int len = rep.Count == 0 ? n : 3;
            for (int l = 0; l < len; l++)
            {
                Console.Write("{0} ", (l % 3) + 1);
            }

            while (rep.Count > 0)
            {
                KeyValuePair<char, int> t = rep.Dequeue();
                int s = t.Value % 3 == 0 ? 1 : t.Value + 1;
                Console.Write("{0} ", s);
                Console.Write("{0} ", s % 3 == 0 ? 1 : s + 1);
            }
        }
    }
}


using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Numerics;

namespace cf207
{
    class Program
    {
        static void Main(string[] args)
        {
            //Console.SetIn(new StreamReader("input.txt"));
            solve_cf207B();
        }

        public static void solve_cf207B()
        {
            int[] nm = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int n = nm[0];
            int m = nm[1];

            Dictionary<int, int> dic = new Dictionary<int, int>();

            for (int i = 0; i < m; i++)
            {
                string[] row = Console.ReadLine().Split(' ');

                List<int> t = new List<int>();
                int usedK = 0;
                int usedV = 0;
                for (int j = 0; j < row.Length; j++)
                {
                    int num = Convert.ToInt32(row[j]);
                    if (dic.ContainsKey(num))
                    {
                        usedK = num;
                        usedV = dic[num];
                    }
                    else
                    {
                        dic.Add(num, 0);
                    }
                    t.Add(num);
                }

                for (int j = 0; j < t.Count; j++)
                {
                    if (t[j] != usedK)
                    {
                        dic[t[j]] = (usedV % 3) + 1;
                        usedV = (usedV % 3) + 1;
                    }
                }
            }

            var sortedDic = dic.OrderBy(a => a.Key).ToList();
            foreach (KeyValuePair<int, int> pair in sortedDic)
            {
                Console.Write("{0} ", pair.Value);
            }
        }
    }
}