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