#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long int n, i, t1, q, num, num1 = 0, num2 = 0;
  cin >> n;
  vector<pair<long long int, long long int>> v;
  for (i = 0; i < n; i++) {
    cin >> t1;
    v.push_back(make_pair(t1, i));
  }
  stable_sort(v.begin(), v.end());
  cin >> q;
  while (q--) {
    cin >> num;
    long long int l = 0, r = n - 1;
    while (l <= r) {
      long long int mid = (l + r) / 2;
      if (v[mid].first >= num)
        r = mid - 1;
      else
        l = mid + 1;
    }
    num1 += v[l].second + 1;
    num2 += n - v[l].second;
  }
  cout << num1 << " " << num2 << "\n";
}
