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