#include <bits/stdc++.h>
using namespace std;
long long n, m, q, v, p, tmp;
vector<pair<int, int> > arr;
long long binser(long long x) {
  long long l = 0, r = n - 1;
  while (l <= r) {
    long long mid = (l + r) / 2;
    if (arr[mid].first == x) {
      return arr[mid].second;
    } else if (arr[mid].first < x) {
      l = mid + 1;
    } else {
      r = mid - 1;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> tmp;
    arr.push_back(make_pair(tmp, i));
  }
  sort(arr.begin(), arr.end());
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> q;
    long long ans = binser(q);
    v += ans;
    p += n - ans + 1;
  }
  cout << v << " " << p << "\n";
  return 0;
}
