#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i, k, x, a[100005] = {0}, b[100005][3] = {0};
  long long int v = 0, p = 0;
  cin >> n;
  for (i = 1, k = n; i <= n; i++, k--) {
    cin >> a[i];
    b[a[i]][0] = i;
    b[a[i]][1] = k;
  }
  cin >> m;
  while (m--) {
    cin >> x;
    v += b[x][0];
    p += b[x][1];
  }
  cout << v << " " << p << endl;
}
