#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, t, a, countL = 0, countR = 0;
  int v[100001];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a;
    v[a] = i;
  }
  cin >> t;
  while (t--) {
    cin >> a;
    countL = countL + v[a] + 1;
    countR = countR + (n - v[a]);
  }
  cout << countL << " " << countR;
}
