description: Paprika loves permutations. She has an array a_1, a_2, ..., a_n. She wants to make the array a permutation of integers 1 to n.
  
  In order to achieve this goal, she can perform operations on the array. In each operation she can choose two integers i (1 ≤ i ≤ n) and x (x > 0), then perform a_i := a_i mod x (that is, replace a_i by the remainder of a_i divided by x). In different operations, the chosen i and x can be different.
  
  Determine the minimum number of operations needed to make the array a permutation of integers 1 to n. If it is impossible, output -1.
  
  A permutation is an array consisting of n distinct integers from 1 to n in arbitrary order. For example, [2,3,1,5,4] is a permutation, but [1,2,2] is not a permutation (2 appears twice in the array) and [1,3,4] is also not a permutation (n=3 but there is 4 in the array).
  
  Input
  
  Each test contains multiple test cases. The first line contains a single integer t (1 ≤ t ≤ 10^4) — the number of test cases. Description of the test cases follows.
  
  The first line of each test case contains an integer n (1 ≤ n ≤ 10^5).
  
  The second line of each test case contains n integers a_1, a_2, ..., a_n. (1 ≤ a_i ≤ 10^9).
  
  It is guaranteed that the sum of n over all test cases does not exceed 2 ⋅ 10^5.
  
  Output
  
  For each test case, output the minimum number of operations needed to make the array a permutation of integers 1 to n, or -1 if it is impossible.
  
  Example
  
  Input
  
  
  4
  2
  1 7
  3
  1 5 4
  4
  12345678 87654321 20211218 23571113
  9
  1 2 3 4 18 19 5 6 7
  
  
  Output
  
  
  1
  -1
  4
  2
  
  Note
  
  For the first test, the only possible sequence of operations which minimizes the number of operations is: 
  
    * Choose i=2, x=5. Perform a_2 := a_2 mod 5 = 2. 
  
  
  
  For the second test, it is impossible to obtain a permutation of integers from 1 to n.
solution: /* JAIKARA SHERAWAALI DA BOLO SACHE DARBAR KI JAI
  HAR HAR MAHADEV JAI BHOLENAATH
  Rohit Kumar 
  NIT JAMSHEDPUR
  */
  
  import java.util.*;
  
  import java.io.*;
  
  public class Main
  {   
        
     static class FastReader{
  
         BufferedReader br;
         StringTokenizer st;
  
         public FastReader(){
  
         br=new BufferedReader(new InputStreamReader(System.in));
  
  
         }
  
         String next(){
  
         while(st==null||!st.hasMoreTokens()){
           
           try{
  
            st=new StringTokenizer(br.readLine());
  
           }
           catch(IOException e){
  
              e.printStackTrace();
           }
             
  
  
  
         }
         return st.nextToken();}
  
        long nextLong(){ return Long.parseLong(next());}
  
        int nextInt(){ return Integer.parseInt(next());}
  
  
         }
       
     static <t>void print(t o){
      System.out.println(o);
     }
      
     static boolean islapindrome(String s){
  
         int fhalf[]=new int[26];
         int shalf[]=new int[26];
  
          int i=0,j=s.length()-1;
          while(i<j){
             fhalf[s.charAt(i)-'a']++;
             shalf[s.charAt(j)-'a']++;
     i++;
     j--;
     
  
          }
  
          for(int k=0;k<26;k++){
            if(fhalf[k]!=shalf[k])return false;
          }
      return true;
  
  
  
  
     }
  
      static int mod=(int)1e9+7;
    static String text="foo";
    public static void main (String args[]) throws IOException{
    try{
      System.setIn(new FileInputStream("input.txt"));
      System.setOut(new PrintStream(new FileOutputStream("output.txt"))); } 
      catch (Exception e) {
      System.err.println("Error");
       }
       
       
       FastReader sc=new FastReader();
       int tt=sc.nextInt();
        while(tt-->0)
        {
           int n=sc.nextInt();
            List<Integer> arr=new ArrayList<>();
            boolean flag=false;
            long ans=0;
           for(int i=0;i<n;i++)
           {
               arr.add(sc.nextInt());
           }
           Collections.sort(arr);
           TreeSet<Integer> ts=new TreeSet<>();
           for(int i=1;i<=n;i++)
           {
               ts.add(i);
           }
           for(int i:arr)
           {
               if(i<=n&&ts.contains(i))
               {
                   ts.remove(i);
                   continue;
               }
               int m=(i-1)/2;
               if(ts.first()>m)
               {
                   flag=true;
                   break;
               }
               else{
                   ts.remove(ts.first());
                   ans++;
               }
           }
           if(flag)
           {
               System.out.println(-1);
           }
           else{
              System.out.println(ans);
           }
          //  
  
  
  
  
        } 
  
  
         
  
  
  
  
      }
  
   
      static void reverse(int[] arr, int from, int till) {
          for (int i = from, j = till; i < j; i++, j--) {
              swap(arr, i, j);
          }
      }
  
      static void swap(int[] arr, int a, int b) {
          int tmp = arr[a];
          arr[a] = arr[b];
          arr[b] = tmp;
      }
  
      
      
      
      void sieveOfEratosthenes(int n)
      {
          boolean prime[] = new boolean[n+1];
          for(int i=0;i<=n;i++)
              prime[i] = true;
           
          for(int p = 2; p*p <=n; p++)
          {
              if(prime[p] == true)
              {
                  for(int i = p*p; i <= n; i += p)
                      prime[i] = false;
              }
          }
          for(int i = 2; i <= n; i++)
          {
              if(prime[i] == true)
                  System.out.print(i + " ");
          }
      }
      static long gcd(long a,long b)
      {
          if(b==0) return a;
          
          return gcd(b,a%b);
      }
      static boolean isprime(int n)
      {
          if(n<=1)
           return false;
          
          if(n<=3)
           return true;
          
          if(n%2==0||n%3==0)
           return false;
          
          for(int i=5;i*i<=n;i=i+6)
          {
              if(n%i==0||n%(i+2)==0)
                return false;
          }
          return true;
      }
  
  
  
     }
   