#include <bits/stdc++.h>   using namespace std;   int a[100], b[100];   int main() {     int n, m, i, j, num, temp, maxn;     scanf( %d , &n);     for (i = 0; i < n; i++) scanf( %d , &a[i]);     scanf( %d , &m);     for (i = 0; i < m; i++) scanf( %d , &b[i]);     num = temp = maxn = 0;     for (i = 0; i < n; i++)       for (j = 0; j < m; j++) {         if (b[j] % a[i] == 0) {           temp = b[j] / a[i];           if (temp > maxn) {             num = 1;             maxn = temp;           } else if (temp == maxn)             num++;         }       }     printf( %d n , num);   }   