#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, val;
  map<int, int> arr;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> val;
    arr.insert(make_pair(val, i));
  }
  cin >> m;
  long long V = 0, P = 0;
  int ind;
  for (int i = 0; i < m; i++) {
    cin >> val;
    ind = arr[val];
    V += (ind + 1);
    P += (n - ind);
  }
  cout << V << " " << P << endl;
  return 0;
}
