import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.NoSuchElementException;
public class Main {
	public static void main(String[] args)throws Exception{
		PrintWriter out = new PrintWriter(System.out);
		int n=nextInt();
		int S[]=new int[n];
		int k=-1;
		for(int i=0;i<n;i++){
			S[i]=nextInt();
			if(S[i]==k)
				S[i]=-1;
			else
				if(k!=S[i])
					k=S[i];
		}
		int q=nextInt();
		int T[]=new int[q];
		for(int i=0;i<q;i++)T[i]=nextInt();
		int ans=0;
		Arrays.sort(T);
		for(int i=0;i<n;i++){
			int a=Arrays.binarySearch(T,S[i]);
			if(a<q&&0<=a&&T[a]==S[i])
				ans++;
		}
		System.out.println(ans);
	}
	static boolean isOK(int index,int key,int[]a){
		if (key>=a[index]) return true;
	    else return false;
	}
	static int binary_search(int key,int[] a) {
	    int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	    int ok = (int)a.length; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	    while (Math.abs(ok - ng) > 1) {
	        int mid = (ok + ng) / 2;
	        if (isOK(mid,key,a)) ok = mid;
	        else ng = mid;
	    }
	    return ok;
	}
	//FastScanner
	static InputStream in = System.in;
	static  byte[] buffer = new byte[1024];
	static int length = 0, p = 0;
	public static boolean hasNextByte () {
		if (p < length) return true;
		else {
			p = 0;
			try {length = in.read(buffer);}
			catch (Exception e) {e.printStackTrace();}
			if (length == 0) return false;
		}
		return true;
	}
	public static int readByte () {
		if (hasNextByte() == true) return buffer[p++];
		return -1;
	}
	public static boolean isPrintable (int n) {return 33<=n&&n<=126;}
	public static void skip () {
		while (hasNextByte() && !isPrintable(buffer[p])) p++;
	}
	public static boolean hasNext () {skip(); return hasNextByte();}
	public static String next () {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int temp = readByte();
		while (isPrintable(temp)) {
			sb.appendCodePoint(temp);
			temp = readByte();
		}
		return sb.toString();
	}
	public static int nextInt () {return Math.toIntExact(nextLong());}
	public static int[] nextInts (int n) {
		int[] ar = new int[n];
		for (int i=0; i<n; i++) ar[i] = nextInt();
		return ar;
	}
	public static long nextLong () {
		if (!hasNext()) throw new NoSuchElementException();
		boolean minus = false;
		int temp = readByte();
		if (temp == '-') {
			minus = true;
			temp = readByte();
		}
		if (temp<'0' || '9'<temp) throw new NumberFormatException();
		long n = 0;
		while (isPrintable(temp)) {
			if ('0'<=temp && temp<='9') {
				n *= 10;
				n += temp - '0';
			}
			temp = readByte();
		}
		return minus? -n : n;
	}
}

 import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.Arrays; Arrays java.util import java.util.NoSuchElementException; NoSuchElementException java.util public class Main {
	public static void main(String[] args)throws Exception{
		PrintWriter out = new PrintWriter(System.out);
		int n=nextInt();
		int S[]=new int[n];
		int k=-1;
		for(int i=0;i<n;i++){
			S[i]=nextInt();
			if(S[i]==k)
				S[i]=-1;
			else
				if(k!=S[i])
					k=S[i];
		}
		int q=nextInt();
		int T[]=new int[q];
		for(int i=0;i<q;i++)T[i]=nextInt();
		int ans=0;
		Arrays.sort(T);
		for(int i=0;i<n;i++){
			int a=Arrays.binarySearch(T,S[i]);
			if(a<q&&0<=a&&T[a]==S[i])
				ans++;
		}
		System.out.println(ans);
	}
	static boolean isOK(int index,int key,int[]a){
		if (key>=a[index]) return true;
	    else return false;
	}
	static int binary_search(int key,int[] a) {
	    int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	    int ok = (int)a.length; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	    while (Math.abs(ok - ng) > 1) {
	        int mid = (ok + ng) / 2;
	        if (isOK(mid,key,a)) ok = mid;
	        else ng = mid;
	    }
	    return ok;
	}
	//FastScanner
	static InputStream in = System.in;
	static  byte[] buffer = new byte[1024];
	static int length = 0, p = 0;
	public static boolean hasNextByte () {
		if (p < length) return true;
		else {
			p = 0;
			try {length = in.read(buffer);}
			catch (Exception e) {e.printStackTrace();}
			if (length == 0) return false;
		}
		return true;
	}
	public static int readByte () {
		if (hasNextByte() == true) return buffer[p++];
		return -1;
	}
	public static boolean isPrintable (int n) {return 33<=n&&n<=126;}
	public static void skip () {
		while (hasNextByte() && !isPrintable(buffer[p])) p++;
	}
	public static boolean hasNext () {skip(); return hasNextByte();}
	public static String next () {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int temp = readByte();
		while (isPrintable(temp)) {
			sb.appendCodePoint(temp);
			temp = readByte();
		}
		return sb.toString();
	}
	public static int nextInt () {return Math.toIntExact(nextLong());}
	public static int[] nextInts (int n) {
		int[] ar = new int[n];
		for (int i=0; i<n; i++) ar[i] = nextInt();
		return ar;
	}
	public static long nextLong () {
		if (!hasNext()) throw new NoSuchElementException();
		boolean minus = false;
		int temp = readByte();
		if (temp == '-') {
			minus = true;
			temp = readByte();
		}
		if (temp<'0' || '9'<temp) throw new NumberFormatException();
		long n = 0;
		while (isPrintable(temp)) {
			if ('0'<=temp && temp<='9') {
				n *= 10;
				n += temp - '0';
			}
			temp = readByte();
		}
		return minus? -n : n;
	}
} Main //FastScanner
	static InputStream in = System.in; in System.in System System.in static  byte[] buffer = new byte[1024]; buffer new byte[1024] 1024 static int length = 0 length 0 p = 0; p 0 public static void main(String[] args)throws Exception{
		PrintWriter out = new PrintWriter(System.out);
		int n=nextInt();
		int S[]=new int[n];
		int k=-1;
		for(int i=0;i<n;i++){
			S[i]=nextInt();
			if(S[i]==k)
				S[i]=-1;
			else
				if(k!=S[i])
					k=S[i];
		}
		int q=nextInt();
		int T[]=new int[q];
		for(int i=0;i<q;i++)T[i]=nextInt();
		int ans=0;
		Arrays.sort(T);
		for(int i=0;i<n;i++){
			int a=Arrays.binarySearch(T,S[i]);
			if(a<q&&0<=a&&T[a]==S[i])
				ans++;
		}
		System.out.println(ans);
	} main {
		PrintWriter out = new PrintWriter(System.out);
		int n=nextInt();
		int S[]=new int[n];
		int k=-1;
		for(int i=0;i<n;i++){
			S[i]=nextInt();
			if(S[i]==k)
				S[i]=-1;
			else
				if(k!=S[i])
					k=S[i];
		}
		int q=nextInt();
		int T[]=new int[q];
		for(int i=0;i<q;i++)T[i]=nextInt();
		int ans=0;
		Arrays.sort(T);
		for(int i=0;i<n;i++){
			int a=Arrays.binarySearch(T,S[i]);
			if(a<q&&0<=a&&T[a]==S[i])
				ans++;
		}
		System.out.println(ans);
	} PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) int n=nextInt(); n nextInt() nextInt int S[]=new int[n]; S new int[n] n int k=-1; k -1 1 for(int i=0;i<n;i++){
			S[i]=nextInt();
			if(S[i]==k)
				S[i]=-1;
			else
				if(k!=S[i])
					k=S[i];
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			S[i]=nextInt();
			if(S[i]==k)
				S[i]=-1;
			else
				if(k!=S[i])
					k=S[i];
		} {
			S[i]=nextInt();
			if(S[i]==k)
				S[i]=-1;
			else
				if(k!=S[i])
					k=S[i];
		} S[i]=nextInt() S[i] S i nextInt() nextInt if(S[i]==k)
				S[i]=-1;
			else
				if(k!=S[i])
					k=S[i]; S[i]==k S[i] S i k S[i]=-1 S[i] S i -1 1 if(k!=S[i])
					k=S[i]; k!=S[i] k S[i] S i k=S[i] k S[i] S i int q=nextInt(); q nextInt() nextInt int T[]=new int[q]; T new int[q] q for(int i=0;i<q;i++)T[i]=nextInt(); int i=0; int i=0; i 0 i<q i q i++ i++ i T[i]=nextInt(); T[i]=nextInt() T[i] T i nextInt() nextInt int ans=0; ans 0 Arrays.sort(T) Arrays.sort Arrays T for(int i=0;i<n;i++){
			int a=Arrays.binarySearch(T,S[i]);
			if(a<q&&0<=a&&T[a]==S[i])
				ans++;
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			int a=Arrays.binarySearch(T,S[i]);
			if(a<q&&0<=a&&T[a]==S[i])
				ans++;
		} {
			int a=Arrays.binarySearch(T,S[i]);
			if(a<q&&0<=a&&T[a]==S[i])
				ans++;
		} int a=Arrays.binarySearch(T,S[i]); a Arrays.binarySearch(T,S[i]) Arrays.binarySearch Arrays T S[i] S i if(a<q&&0<=a&&T[a]==S[i])
				ans++; a<q&&0<=a&&T[a]==S[i] a<q&&0<=a&&T[a]==S[i] a<q a q 0<=a 0 a T[a]==S[i] T[a] T a S[i] S i ans++ ans System.out.println(ans) System.out.println System.out System System.out ans String[] args args static boolean isOK(int index,int key,int[]a){
		if (key>=a[index]) return true;
	    else return false;
	} isOK {
		if (key>=a[index]) return true;
	    else return false;
	} if (key>=a[index]) return true;
	    else return false; key>=a[index] key a[index] a index return true; true return false; false int index index int key key int[]a a static int binary_search(int key,int[] a) {
	    int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	    int ok = (int)a.length; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	    while (Math.abs(ok - ng) > 1) {
	        int mid = (ok + ng) / 2;
	        if (isOK(mid,key,a)) ok = mid;
	        else ng = mid;
	    }
	    return ok;
	} binary_search {
	    int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	    int ok = (int)a.length; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	    while (Math.abs(ok - ng) > 1) {
	        int mid = (ok + ng) / 2;
	        if (isOK(mid,key,a)) ok = mid;
	        else ng = mid;
	    }
	    return ok;
	} int ng = -1; ng -1 1 int ok = (int)a.length; ok (int)a.length a a.length while (Math.abs(ok - ng) > 1) {
	        int mid = (ok + ng) / 2;
	        if (isOK(mid,key,a)) ok = mid;
	        else ng = mid;
	    } Math.abs(ok - ng) > 1 Math.abs(ok - ng) Math.abs Math ok - ng ok ng 1 {
	        int mid = (ok + ng) / 2;
	        if (isOK(mid,key,a)) ok = mid;
	        else ng = mid;
	    } int mid = (ok + ng) / 2; mid (ok + ng) / 2 (ok + ng) ok ng 2 if (isOK(mid,key,a)) ok = mid;
	        else ng = mid; isOK(mid,key,a) isOK mid key a ok = mid ok mid ng = mid ng mid return ok; ok int key key int[] a a public static boolean hasNextByte () {
		if (p < length) return true;
		else {
			p = 0;
			try {length = in.read(buffer);}
			catch (Exception e) {e.printStackTrace();}
			if (length == 0) return false;
		}
		return true;
	} hasNextByte {
		if (p < length) return true;
		else {
			p = 0;
			try {length = in.read(buffer);}
			catch (Exception e) {e.printStackTrace();}
			if (length == 0) return false;
		}
		return true;
	} if (p < length) return true;
		else {
			p = 0;
			try {length = in.read(buffer);}
			catch (Exception e) {e.printStackTrace();}
			if (length == 0) return false;
		} p < length p length return true; true {
			p = 0;
			try {length = in.read(buffer);}
			catch (Exception e) {e.printStackTrace();}
			if (length == 0) return false;
		} p = 0 p 0 try {length = in.read(buffer);}
			catch (Exception e) {e.printStackTrace();} catch (Exception e) {e.printStackTrace();} Exception e {e.printStackTrace();} e.printStackTrace() e.printStackTrace e {length = in.read(buffer);} length = in.read(buffer) length in.read(buffer) in.read in buffer if (length == 0) return false; length == 0 length 0 return false; false return true; true public static int readByte () {
		if (hasNextByte() == true) return buffer[p++];
		return -1;
	} readByte {
		if (hasNextByte() == true) return buffer[p++];
		return -1;
	} if (hasNextByte() == true) return buffer[p++]; hasNextByte() == true hasNextByte() hasNextByte true return buffer[p++]; buffer[p++] buffer p++ p return -1; -1 1 public static boolean isPrintable (int n) {return 33<=n&&n<=126;} isPrintable {return 33<=n&&n<=126;} return 33<=n&&n<=126; 33<=n&&n<=126 33<=n 33 n n<=126 n 126 int n n public static void skip () {
		while (hasNextByte() && !isPrintable(buffer[p])) p++;
	} skip {
		while (hasNextByte() && !isPrintable(buffer[p])) p++;
	} while (hasNextByte() && !isPrintable(buffer[p])) p++; hasNextByte() && !isPrintable(buffer[p]) hasNextByte() hasNextByte !isPrintable(buffer[p]) isPrintable(buffer[p]) isPrintable buffer[p] buffer p p++ p public static boolean hasNext () {skip(); return hasNextByte();} hasNext {skip(); return hasNextByte();} skip() skip return hasNextByte(); hasNextByte() hasNextByte public static String next () {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int temp = readByte();
		while (isPrintable(temp)) {
			sb.appendCodePoint(temp);
			temp = readByte();
		}
		return sb.toString();
	} next {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int temp = readByte();
		while (isPrintable(temp)) {
			sb.appendCodePoint(temp);
			temp = readByte();
		}
		return sb.toString();
	} if (!hasNext()) throw new NoSuchElementException(); !hasNext() hasNext() hasNext throw new NoSuchElementException(); new NoSuchElementException() StringBuilder sb = new StringBuilder(); sb new StringBuilder() int temp = readByte(); temp readByte() readByte while (isPrintable(temp)) {
			sb.appendCodePoint(temp);
			temp = readByte();
		} isPrintable(temp) isPrintable temp {
			sb.appendCodePoint(temp);
			temp = readByte();
		} sb.appendCodePoint(temp) sb.appendCodePoint sb temp temp = readByte() temp readByte() readByte return sb.toString(); sb.toString() sb.toString sb public static int nextInt () {return Math.toIntExact(nextLong());} nextInt {return Math.toIntExact(nextLong());} return Math.toIntExact(nextLong()); Math.toIntExact(nextLong()) Math.toIntExact Math nextLong() nextLong public static int[] nextInts (int n) {
		int[] ar = new int[n];
		for (int i=0; i<n; i++) ar[i] = nextInt();
		return ar;
	} nextInts {
		int[] ar = new int[n];
		for (int i=0; i<n; i++) ar[i] = nextInt();
		return ar;
	} int[] ar = new int[n]; ar new int[n] n for (int i=0; i<n; i++) ar[i] = nextInt(); int i=0; int i=0; i 0 i<n i n i++ i++ i ar[i] = nextInt(); ar[i] = nextInt() ar[i] ar i nextInt() nextInt return ar; ar int n n public static long nextLong () {
		if (!hasNext()) throw new NoSuchElementException();
		boolean minus = false;
		int temp = readByte();
		if (temp == '-') {
			minus = true;
			temp = readByte();
		}
		if (temp<'0' || '9'<temp) throw new NumberFormatException();
		long n = 0;
		while (isPrintable(temp)) {
			if ('0'<=temp && temp<='9') {
				n *= 10;
				n += temp - '0';
			}
			temp = readByte();
		}
		return minus? -n : n;
	} nextLong {
		if (!hasNext()) throw new NoSuchElementException();
		boolean minus = false;
		int temp = readByte();
		if (temp == '-') {
			minus = true;
			temp = readByte();
		}
		if (temp<'0' || '9'<temp) throw new NumberFormatException();
		long n = 0;
		while (isPrintable(temp)) {
			if ('0'<=temp && temp<='9') {
				n *= 10;
				n += temp - '0';
			}
			temp = readByte();
		}
		return minus? -n : n;
	} if (!hasNext()) throw new NoSuchElementException(); !hasNext() hasNext() hasNext throw new NoSuchElementException(); new NoSuchElementException() boolean minus = false; minus false int temp = readByte(); temp readByte() readByte if (temp == '-') {
			minus = true;
			temp = readByte();
		} temp == '-' temp '-' {
			minus = true;
			temp = readByte();
		} minus = true minus true temp = readByte() temp readByte() readByte if (temp<'0' || '9'<temp) throw new NumberFormatException(); temp<'0' || '9'<temp temp<'0' temp '0' '9'<temp '9' temp throw new NumberFormatException(); new NumberFormatException() long n = 0; n 0 while (isPrintable(temp)) {
			if ('0'<=temp && temp<='9') {
				n *= 10;
				n += temp - '0';
			}
			temp = readByte();
		} isPrintable(temp) isPrintable temp {
			if ('0'<=temp && temp<='9') {
				n *= 10;
				n += temp - '0';
			}
			temp = readByte();
		} if ('0'<=temp && temp<='9') {
				n *= 10;
				n += temp - '0';
			} '0'<=temp && temp<='9' '0'<=temp '0' temp temp<='9' temp '9' {
				n *= 10;
				n += temp - '0';
			} n *= 10 n 10 n += temp - '0' n temp - '0' temp '0' temp = readByte() temp readByte() readByte return minus? -n : n; minus? -n : n minus -n n n public class Main {
	public static void main(String[] args)throws Exception{
		PrintWriter out = new PrintWriter(System.out);
		int n=nextInt();
		int S[]=new int[n];
		int k=-1;
		for(int i=0;i<n;i++){
			S[i]=nextInt();
			if(S[i]==k)
				S[i]=-1;
			else
				if(k!=S[i])
					k=S[i];
		}
		int q=nextInt();
		int T[]=new int[q];
		for(int i=0;i<q;i++)T[i]=nextInt();
		int ans=0;
		Arrays.sort(T);
		for(int i=0;i<n;i++){
			int a=Arrays.binarySearch(T,S[i]);
			if(a<q&&0<=a&&T[a]==S[i])
				ans++;
		}
		System.out.println(ans);
	}
	static boolean isOK(int index,int key,int[]a){
		if (key>=a[index]) return true;
	    else return false;
	}
	static int binary_search(int key,int[] a) {
	    int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	    int ok = (int)a.length; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	    while (Math.abs(ok - ng) > 1) {
	        int mid = (ok + ng) / 2;
	        if (isOK(mid,key,a)) ok = mid;
	        else ng = mid;
	    }
	    return ok;
	}
	//FastScanner
	static InputStream in = System.in;
	static  byte[] buffer = new byte[1024];
	static int length = 0, p = 0;
	public static boolean hasNextByte () {
		if (p < length) return true;
		else {
			p = 0;
			try {length = in.read(buffer);}
			catch (Exception e) {e.printStackTrace();}
			if (length == 0) return false;
		}
		return true;
	}
	public static int readByte () {
		if (hasNextByte() == true) return buffer[p++];
		return -1;
	}
	public static boolean isPrintable (int n) {return 33<=n&&n<=126;}
	public static void skip () {
		while (hasNextByte() && !isPrintable(buffer[p])) p++;
	}
	public static boolean hasNext () {skip(); return hasNextByte();}
	public static String next () {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int temp = readByte();
		while (isPrintable(temp)) {
			sb.appendCodePoint(temp);
			temp = readByte();
		}
		return sb.toString();
	}
	public static int nextInt () {return Math.toIntExact(nextLong());}
	public static int[] nextInts (int n) {
		int[] ar = new int[n];
		for (int i=0; i<n; i++) ar[i] = nextInt();
		return ar;
	}
	public static long nextLong () {
		if (!hasNext()) throw new NoSuchElementException();
		boolean minus = false;
		int temp = readByte();
		if (temp == '-') {
			minus = true;
			temp = readByte();
		}
		if (temp<'0' || '9'<temp) throw new NumberFormatException();
		long n = 0;
		while (isPrintable(temp)) {
			if ('0'<=temp && temp<='9') {
				n *= 10;
				n += temp - '0';
			}
			temp = readByte();
		}
		return minus? -n : n;
	}
} public class Main {
	public static void main(String[] args)throws Exception{
		PrintWriter out = new PrintWriter(System.out);
		int n=nextInt();
		int S[]=new int[n];
		int k=-1;
		for(int i=0;i<n;i++){
			S[i]=nextInt();
			if(S[i]==k)
				S[i]=-1;
			else
				if(k!=S[i])
					k=S[i];
		}
		int q=nextInt();
		int T[]=new int[q];
		for(int i=0;i<q;i++)T[i]=nextInt();
		int ans=0;
		Arrays.sort(T);
		for(int i=0;i<n;i++){
			int a=Arrays.binarySearch(T,S[i]);
			if(a<q&&0<=a&&T[a]==S[i])
				ans++;
		}
		System.out.println(ans);
	}
	static boolean isOK(int index,int key,int[]a){
		if (key>=a[index]) return true;
	    else return false;
	}
	static int binary_search(int key,int[] a) {
	    int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	    int ok = (int)a.length; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	    while (Math.abs(ok - ng) > 1) {
	        int mid = (ok + ng) / 2;
	        if (isOK(mid,key,a)) ok = mid;
	        else ng = mid;
	    }
	    return ok;
	}
	//FastScanner
	static InputStream in = System.in;
	static  byte[] buffer = new byte[1024];
	static int length = 0, p = 0;
	public static boolean hasNextByte () {
		if (p < length) return true;
		else {
			p = 0;
			try {length = in.read(buffer);}
			catch (Exception e) {e.printStackTrace();}
			if (length == 0) return false;
		}
		return true;
	}
	public static int readByte () {
		if (hasNextByte() == true) return buffer[p++];
		return -1;
	}
	public static boolean isPrintable (int n) {return 33<=n&&n<=126;}
	public static void skip () {
		while (hasNextByte() && !isPrintable(buffer[p])) p++;
	}
	public static boolean hasNext () {skip(); return hasNextByte();}
	public static String next () {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int temp = readByte();
		while (isPrintable(temp)) {
			sb.appendCodePoint(temp);
			temp = readByte();
		}
		return sb.toString();
	}
	public static int nextInt () {return Math.toIntExact(nextLong());}
	public static int[] nextInts (int n) {
		int[] ar = new int[n];
		for (int i=0; i<n; i++) ar[i] = nextInt();
		return ar;
	}
	public static long nextLong () {
		if (!hasNext()) throw new NoSuchElementException();
		boolean minus = false;
		int temp = readByte();
		if (temp == '-') {
			minus = true;
			temp = readByte();
		}
		if (temp<'0' || '9'<temp) throw new NumberFormatException();
		long n = 0;
		while (isPrintable(temp)) {
			if ('0'<=temp && temp<='9') {
				n *= 10;
				n += temp - '0';
			}
			temp = readByte();
		}
		return minus? -n : n;
	}
} Main
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.NoSuchElementException;
public class Main {
	public static void main(String[] args)throws Exception{
		PrintWriter out = new PrintWriter(System.out);
		int n=nextInt();
		int S[]=new int[n];
		int k=-1;
		for(int i=0;i<n;i++){
			S[i]=nextInt();
			if(S[i]==k)
				S[i]=-1;
			else
				if(k!=S[i])
					k=S[i];
		}
		int q=nextInt();
		int T[]=new int[q];
		for(int i=0;i<q;i++)T[i]=nextInt();
		int ans=0;
		Arrays.sort(T);
		for(int i=0;i<n;i++){
			int a=Arrays.binarySearch(T,S[i]);
			if(a<q&&0<=a&&T[a]==S[i])
				ans++;
		}
		System.out.println(ans);
	}
	static boolean isOK(int index,int key,int[]a){
		if (key>=a[index]) return true;
	    else return false;
	}
	static int binary_search(int key,int[] a) {
	    int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	    int ok = (int)a.length; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	    while (Math.abs(ok - ng) > 1) {
	        int mid = (ok + ng) / 2;
	        if (isOK(mid,key,a)) ok = mid;
	        else ng = mid;
	    }
	    return ok;
	}
	//FastScanner
	static InputStream in = System.in;
	static  byte[] buffer = new byte[1024];
	static int length = 0, p = 0;
	public static boolean hasNextByte () {
		if (p < length) return true;
		else {
			p = 0;
			try {length = in.read(buffer);}
			catch (Exception e) {e.printStackTrace();}
			if (length == 0) return false;
		}
		return true;
	}
	public static int readByte () {
		if (hasNextByte() == true) return buffer[p++];
		return -1;
	}
	public static boolean isPrintable (int n) {return 33<=n&&n<=126;}
	public static void skip () {
		while (hasNextByte() && !isPrintable(buffer[p])) p++;
	}
	public static boolean hasNext () {skip(); return hasNextByte();}
	public static String next () {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int temp = readByte();
		while (isPrintable(temp)) {
			sb.appendCodePoint(temp);
			temp = readByte();
		}
		return sb.toString();
	}
	public static int nextInt () {return Math.toIntExact(nextLong());}
	public static int[] nextInts (int n) {
		int[] ar = new int[n];
		for (int i=0; i<n; i++) ar[i] = nextInt();
		return ar;
	}
	public static long nextLong () {
		if (!hasNext()) throw new NoSuchElementException();
		boolean minus = false;
		int temp = readByte();
		if (temp == '-') {
			minus = true;
			temp = readByte();
		}
		if (temp<'0' || '9'<temp) throw new NumberFormatException();
		long n = 0;
		while (isPrintable(temp)) {
			if ('0'<=temp && temp<='9') {
				n *= 10;
				n += temp - '0';
			}
			temp = readByte();
		}
		return minus? -n : n;
	}
}


