/*
  Contest 091
  B - Two Colors Card Game
  Rakesh Kumar --> 21/09/2020
 */

#include <bits/stdc++.h>

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(0); std::cout.tie(0);

    std::unordered_map<std::string, int> dict;
    int n = 0;
    std::cin >> n;
    std::cin.ignore();
    while (n--) {
        std::string s;
        std::getline(std::cin, s);
        ++dict[s];
    }
    std::cin >> n;
    std::cin.ignore();
    while (n--) {
        std::string s;
        std::getline(std::cin, s);
        --dict[s];
    }

    int max = 0;
    for (auto it : dict)
        max = std::max(max, it.second);
    std::cout << max << std::endl;

    return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <map>
#include <iomanip>

using ll = long long;
using ld = long double;
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))

int const nmax = 200000;
std::vector<std::pair<int,int>> v;
std::map<std::pair<int,int>,int> mp;

int main() {
  int n;
  std::cin >> n;
  for(int i = 1;i <= n; i++) {
    ld init;
    std::cin >> init;
    ll number = llround(1000000000LL * init);
    std::pair<int,int> basic(0, 0);

    while(number % 2 == 0) {
      number /= 2;
      basic.first++;
    }
    while(number % 5 == 0) {
      number /= 5;
      basic.second++;
    }
    mp[basic]++;
    if(mp[basic] == 1)
      v.push_back(basic);
  }
  ll result = 0;

  for(int i = 0; i < v.size(); i++)
    for(int j = i; j < v.size(); j++)
      if(18 <= v[i].first + v[j].first && 18 <= v[i].second + v[j].second) {
        if(i == j)
          result += 1LL *  mp[v[i]] * (mp[v[i]] - 1) / 2;
        else
          result += 1LL * mp[v[i]] * mp[v[j]];
      }
  std::cout << result;
}
