#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, q, no, sum1 = 0, sum2 = 0, m;
  cin >> n;
  int a[n + 1];
  for (int i = 0; i < n; i++) {
    cin >> m;
    a[m] = i + 1;
  }
  cin >> q;
  while (q-- > 0) {
    cin >> no;
    sum1 += a[no];
    sum2 += n - a[no] + 1;
  }
  cout << sum1 << " " << sum2;
  return 0;
}
