#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, cs = 0, ce = 0, temp, in;
  map<long long, long long> mp;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> in;
    mp[in] = i;
  }
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> in;
    temp = mp[in];
    cs += temp + 1;
    ce += n - temp;
  }
  cout << cs << " " << ce;
  return 0;
}
