#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[100001], m, input, fLocalCount, bLocalCount;
  long long int fCounter = 0, bCounter = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> input;
    a[input] = i + 1;
  }
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> input;
    fLocalCount = a[input];
    bLocalCount = n + 1 - fLocalCount;
    fCounter += fLocalCount;
    bCounter += bLocalCount;
  }
  cout << fCounter << " " << bCounter;
  return 0;
}
