#include <bits/stdc++.h>
using namespace std;
int main() {
  long long array[100001];
  memset(array, -1, sizeof(array));
  long long n, q, sum1 = 0, sum2 = 0;
  cin >> n;
  long a[n];
  for (int i = 0; i < int(n); i++) {
    cin >> a[i];
    if (array[a[i]] == -1) array[a[i]] = i;
  }
  cin >> q;
  while (q--) {
    long long val;
    cin >> val;
    sum1 += array[val] + 1;
    sum2 += (n - array[val]);
  }
  cout << sum1 << " " << sum2 << endl;
}
