#include <bits/stdc++.h>
int main() {
  int a[100100], n, t, m;
  long long v = 0, p = 0;
  scanf("%d", &n);
  n++;
  for (int i = 1; i < n; i++) scanf("%d", &t), a[t] = i;
  scanf("%d", &m);
  for (int i = 0; i < m; i++) scanf("%d", &t), v += a[t], p += n - a[t];
  printf("%I64d %I64d", v, p);
  return 0;
}
