#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, x;
  cin >> n;
  map<long long int, long long int> a;
  map<long long int, long long int>::iterator it;
  for (int i = 0; i < n; i++) {
    cin >> x;
    a[x] = i + 1;
  }
  long long int m, ca = 0, cb = 0, b;
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> b;
    if (a[b] != 0) {
      x = a[b];
      ca = ca + x;
      cb = cb + (n - x + 1);
    }
  }
  cout << ca << "  " << cb;
  return 0;
}
