#include <bits/stdc++.h>
using namespace std;
int arr[100001];
int main() {
  int n, g, k, l;
  long long p = 0, v = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> g;
    arr[g] = i;
  }
  cin >> k;
  while (k--) {
    cin >> l;
    v += arr[l] + 1;
    p += n - arr[l];
  }
  cout << v << " " << p << endl;
  return 0;
}
