#include <bits/stdc++.h>
using namespace std;
int binSearch(int *a, int n, int x) {
  int l = 0;
  int r = n - 1;
  while (l < r) {
    int mid = (l + r) / 2;
    if (a[mid] == x)
      return mid;
    else if (a[mid] < x)
      l = mid + 1;
    else
      r = mid - 1;
  }
  return -1;
}
int main() {
  map<long long, long long> mp;
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    mp[a[i]] = i + 1;
  }
  int q;
  cin >> q;
  long long cntFirst = 0, cntSecond = 0;
  for (int i = 0; i < q; i++) {
    int x;
    cin >> x;
    long long res = mp[x];
    cntFirst += res;
    cntSecond += (n - res + 1);
  }
  cout << cntFirst << " " << cntSecond;
  return 0;
}
