In Berland each high school student is characterized by academic performance — integer value between 1 and 5.

In high school 0xFF there are two groups of pupils: the group A and the group B. Each group consists of exactly n students. An academic performance of each student is known — integer value between 1 and 5.

The school director wants to redistribute students between groups so that each of the two groups has the same number of students whose academic performance is equal to 1, the same number of students whose academic performance is 2 and so on. In other words, the purpose of the school director is to change the composition of groups, so that for each value of academic performance the numbers of students in both groups are equal.

To achieve this, there is a plan to produce a series of exchanges of students between groups. During the single exchange the director selects one student from the class A and one student of class B. After that, they both change their groups.

Print the least number of exchanges, in order to achieve the desired equal numbers of students for each academic performance.

Input

The first line of the input contains integer number n (1 ≤ n ≤ 100) — number of students in both groups.

The second line contains sequence of integer numbers a1, a2, ..., an (1 ≤ ai ≤ 5), where ai is academic performance of the i-th student of the group A.

The third line contains sequence of integer numbers b1, b2, ..., bn (1 ≤ bi ≤ 5), where bi is academic performance of the i-th student of the group B.

Output

Print the required minimum number of exchanges or -1, if the desired distribution of students can not be obtained.

Examples

Input

4
5 4 4 4
5 5 4 5


Output

1


Input

6
1 1 1 1 1 1
5 5 5 5 5 5


Output

3


Input

1
5
3


Output

-1


Input

9
3 2 5 5 2 3 3 3 2
4 1 4 1 1 2 4 4 1


Output

4
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Algotic {
	public static void f722_a() throws IOException {
//		Scanner sc = new Scanner(System.in);
		BufferedReader sc=new BufferedReader(new InputStreamReader(System.in));
	    PrintWriter out = new PrintWriter(System.out);
	    int type = Integer.parseInt(sc.readLine());
	    
	    String time = sc.readLine();
	    
//	    out.println(time+"12");
//	    if(true) return ;
	    int deqF = Integer.parseInt(time.substring(3,5));
	    if(deqF >= 60 ) //|| Integer.parseInt(time.substring(4,5)) != 0
	    	time = time.substring(0, 3) + "5" + time.substring(4,5);
//	    else if(deqF == 6 && Integer.parseInt(time.substring(4,5)) != 0)
	    int hour1 = Integer.parseInt(time.substring(0,1));
	    int hour = Integer.parseInt(time.substring(0,2));
	    if(type == 12) {
	    	if(hour1 == 1) {
	    		if(Integer.parseInt(time.substring(1,2)) > 2)
	    			time = time.substring(0, 1) + "1" + time.substring(2);
	    	}
	    	else if(hour1 == 0) {
	    		if(Integer.parseInt(time.substring(1,2)) == 0)
	    			time = time.substring(0, 1) + "1" + time.substring(2);
	    	}
	    	else if(Integer.parseInt(time.substring(0,2)) > 12) {
	    		if(Integer.parseInt(time.substring(1,2)) == 0)
	    			time = "1" + time.substring(1, 2) + time.substring(2);
	    		else 
	    			time = "0" + time.substring(1, 2) + time.substring(2);
	    	}
	    } else if (type == 24) {
	    	if(hour >= 24)
	    		time = "1" + time.substring(1, 2) + time.substring(2);
	    }
	    out.println(time);
	    out.close();
	    sc.close();
	}
	public static void f679_a() {
		Scanner sc = new Scanner(System.in);
	    PrintWriter out = new PrintWriter(System.out);
	    
	    int [] arr = {
	    		2,3,5,7,11,13,17,19,23,29,31,37,41,43,47
	    };
	    int um = 0;
	    
	    int [] arr2 = {
	    		4,9,25,49
	    };
	    
	    outerloop:
	    for(int i=0; i<arr.length; i++) {
	    	System.out.println(arr[i]);
	    	System.out.flush();
	    	if(sc.next().equals("yes")) {
	    		um++;
	    		if(um>=2) {
	    			out.println("composite");
	    			break;
	    		} else {
//	    			if(Arrays.asList(arg0))
	    			for(int j=0; j<arr2.length; j++) {
	    		    	System.out.println(arr2[j]);
	    		    	System.out.flush();
	    		    	if(sc.next().equals("yes")) {
	    		    		
	    		    			out.println("composite");
	    		    			um = 298;
	    		    			break outerloop;
	    		    		
	    		    	}
	    		    }
	    		}
	    	}
	    }
	    if(um < 2)
			out.println("prime");
	    
	    out.close();
	    sc.close();
	}
	
	public static void f724_a() {

		Scanner sc = new Scanner(System.in);
	    PrintWriter out = new PrintWriter(System.out);
	    
	    String a1 = sc.next();
	    String a2 = sc.next();
	    
	    Map<String, Integer> a = new HashMap<String, Integer>();
	    
	    a.put("monday", 1);
	    a.put("tuesday", 2);
	    a.put("wednesday", 3);
	    a.put("thursday", 4);
	    a.put("friday", 5);
	    a.put("saturday", 6);
	    a.put("sunday", 7);
	    
	    int s = a.get(a2) - a.get(a1);
//	    if(s == 0) s = 7;
	    if(s < 0) s = 7 - a.get(a1) + a.get(a2);
	    
	    if(s == (31%7) || s == (28%7) || s == (30%7))
	    	out.println("YES");
	    else out.println("NO");
	    
	    out.close();
	    sc.close();
	
	}
	
	public static void f702_a() {
		Scanner sc = new Scanner(System.in);
	    PrintWriter out = new PrintWriter(System.out);
	    
	   int n = sc.nextInt();
	   long l1 = 0;
	   long l2 = 0;
	   int counter = 0;
	   int maxCounter = 0;
	   for(int i=0; i<n; i++) {
		   l2 = sc.nextInt();
		   if(l2 > l1) {
			   counter++;
			   if(counter > maxCounter)
				   maxCounter=counter;
			   
		   } else {
			   counter = 1;
		   }
		   l1 = l2;
	   }
	    out.println(maxCounter);
	    out.close();
	    sc.close();
	}
	
	public static void f702_b() {
		Scanner sc = new Scanner(System.in);
	    PrintWriter out = new PrintWriter(System.out);
	    
	    ArrayList<Double> stepens2 = new ArrayList<Double>();
	    long res=0;
	   int n = sc.nextInt();
	   double [] numbers = new double[n];
	   for(long i=0; i<n; i++) {
		   numbers[(int) i] = sc.nextInt();
	   }
	   long lastStepen = 0;
	    for(long i=0; i<n; i++) {
	    	for1:  for(long j=i+1; j<n; j++) {
			   double key = numbers[(int) i] + numbers[(int) j];
			   if(stepens2.contains(key))
				   res++;
			   else  {
				   for2 : while(true) {
					   double res2;
					   res2 = key;
					   if((res2 % 2) != 0) {
						   if((res2 / 2) != 0) {
							   // ne 1 deyil nedeki cut
							   
						   }
					   }
					   res2 = res / 2;
					   lastStepen++;
					   double kk = Math.pow(2, lastStepen);
					   stepens2.add(kk);
					   if(kk == key) {
						   res++;
						   continue for1;
					   } else if(kk>key) {
						   break for2;
					   }
				   }
			   }
		   }
	   }
	    out.println(res);
	    out.close();
	    sc.close();
	}
	
	public static void main(String [] args) throws IOException {
		f779_a();
//		f724_a();
	}
	
	public static void f779_a() {

		Scanner sc = new Scanner(System.in);
	    PrintWriter out = new PrintWriter(System.out);
	    
	   int n = sc.nextInt();
	   
	   int [] arr = new int[6];
//	   int [] arr2 = new int[n+1];
	   
	   int k;
	   for(int i=0; i<n; i++) {
		   k = sc.nextInt();   
		   arr[k]++;
	   }
	   
	   for(int i=0; i<n; i++) {
		   k = sc.nextInt();
//		   if(arr[k] > 0)
			   arr[k]--;
//		   else 
//			   arr[k]++;
	   }
	   int sum = 0;
	   int sum2 = 0;
	   for(int i=0; i<6; i++) {
		   if(arr[i] % 2 != 0) {
			   System.out.println("-1");
			   return ;
		   }
		   if(arr[i]>0) {
			   sum2 += arr[i];
		   }
		   sum += arr[i];
	   }
	    
	   if(sum != 0)
		   System.out.println("-1");
	   else System.out.println(sum2/2);
	   
	    out.close();
	    sc.close();
	
	}
	
	public static void f757_a() {

		Scanner sc = new Scanner(System.in);
	    PrintWriter out = new PrintWriter(System.out);
	    
	    String a1 = sc.nextLine();
	    
//	    Bulbasaur
	    
	    int con[] = new int[7];
	    for(int j=0; j<con.length; j++) con[j]=0;
	    
	    for(int i =0; i < a1.length(); i++) {
	    	if(a1.charAt(i) == 'B')
	    		con[0] ++;
	    	if(a1.charAt(i) == 'u')
	    		con[1] ++;
	    	if(a1.charAt(i) == 'l')
	    		con[2] ++;
	    	if(a1.charAt(i) == 'b')
	    		con[3] ++;
	    	if(a1.charAt(i) == 'a')
	    		con[4] ++;
	    	if(a1.charAt(i) == 's')
	    		con[5] ++;
	    	if(a1.charAt(i) == 'r')
	    		con[6] ++;
	    }
	    
	    con[4] = con[4]/2;
	    con[1] = con[1]/2;
	  
	    out.println(Math.min(Math.min(Math.min(con[0], con[1]), Math.min(con[2], con[3])),
	    Math.min(Math.min(con[4], con[5]), con[6])));
	    
	    out.close();
	    sc.close();
	
	}
	
	public static void f709_a() {
		Scanner sc = new Scanner(System.in);
	    PrintWriter out = new PrintWriter(System.out);
	    int n, b, d = 0;
	    n = sc.nextInt();
	    b = sc.nextInt();
	    d = sc.nextInt();
	    int k=0;
	    int res = 0;
	    int bSum = 0, dSum=0;
	    for(int i=0; i<n; i++) {
	    	k = sc.nextInt();
	    	if(k>b)
	    		continue;
	    	dSum += k;
	    	if(dSum > d) {
	    		dSum = 0;
	    		res++;
	    	}
	    }
	    
	    
		out.println(res);
	    out.close();
	    sc.close();
	}
	
	
	public static void f711_a() {
		Scanner sc = new Scanner(System.in);
	    PrintWriter out = new PrintWriter(System.out);
	    int n = 0;
	    n = sc.nextInt();
	    String [] bus = new String[n];
	    String row = "";
	    boolean res = false;
	    sc.nextLine();
	    for(int i=0; i<n; i++) {
	    	row = sc.nextLine();
	    	if(row.contains("OO") && !res) {
	    			row = row.replaceFirst("OO", "++");
	    		res = true;
	    	}
	    	bus[i] = row;
	    }
	    if(res) {
	    	out.println("YES");
	    	for(int i=0; i<n; i++) 
	    		out.println(bus[i]);
	    }
	    else out.println("NO");
	    out.println();
	    out.close();
	    sc.close();
	}
	public static void f710_a() {
		Scanner sc = new Scanner(System.in);
	    PrintWriter out = new PrintWriter(System.out);
	    
	   String n = sc.nextLine();
	   n = n.trim();
	   int res = 8;
	   if(n.substring(0,1).equals("a") || n.substring(0,1).equals("h") ) {
		   if(n.substring(1, 2).equals("1") || n.substring(1, 2).equals("8"))
			res = 3;
		   else res = 5;
	   } else if(n.substring(1, 2).equals("1") || n.substring(1, 2).equals("8")) {
		   res = 5;
	   }
	   else res = 8;
	   out.println(res+"");
	    out.close();
	    sc.close();
	}
}
