#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m, i, j, k, l, t, x, y, z;
  cin >> n;
  long long int a[n + 5];
  map<long long int, long long int> make_pair;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    make_pair[a[i]] = i;
  }
  cin >> m;
  long long int p = 0, q = 0;
  for (i = 0; i < m; i++) {
    cin >> x;
    k = make_pair[x];
    j = n - make_pair[x] + 1;
    p += k;
    q += j;
  }
  cout << p << " " << q << endl;
}
