#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, nq;
  std::vector<long long> input, queries;
  std::map<long long, long long> lookupTable;
  cin >> n;
  for (long long i = 0; i < n; ++i) {
    long long next;
    cin >> next;
    input.push_back(next);
  }
  cin >> nq;
  for (long long i = 0; i < nq; ++i) {
    long long next;
    cin >> next;
    queries.push_back(next);
  }
  long long index = 0;
  for (auto& i : input) {
    lookupTable[i] = index;
    ++index;
  }
  long long counta = 0, countb = 0;
  for (auto& q : queries) {
    counta += lookupTable[q] + 1;
    countb += n - lookupTable[q];
  }
  cout << counta << " " << countb;
}
