import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N];
        int[] B = new int[N];
        for(int i = 0; i < N; ++i) A[i] = sc.nextInt();
        for(int i = 0; i < N; ++i) B[i] = sc.nextInt();
        Arrays.sort(A);
        Arrays.sort(B);//两个数组都排序好
        int r = f(A, B, 0, 0);//两个指针从左开始匹配
        if(r < N) r++;//原本有不匹配的,改B可以增加一个
        else if(r == N) r--;//原本全部匹配的,改B会减少一个
        System.out.println(r);
    }
    public static int f(int[] A, int[] B, int i, int j){
        if(i >= A.length || j >= B.length) return 0;
        if(A[i] > B[j]) return f(A, B, i, j + 1);
        if(A[i] < B[j]) return f(A, B, i + 1, j);
        return 1 + f(A, B, i + 1, j + 1);//成功匹配到一对
    }
}