#include <bits/stdc++.h>
using namespace std;
int main() {
  int l = 100000;
  long long comp1 = 0;
  long long comp2 = 0;
  int R[l];
  int n;
  cin >> n;
  int T[n + 1];
  int i = 1;
  for (; i <= n; i++) {
    cin >> T[i];
    R[T[i]] = i;
  }
  int m;
  cin >> m;
  int pos;
  int b[m + 1];
  for (i = 1; i <= m; i++) {
    cin >> b[i];
    pos = R[b[i]];
    comp1 += pos;
    comp2 += n - pos + 1;
  }
  cout << comp1 << ' ' << comp2 << endl;
  return 0;
}
