#include <bits/stdc++.h>
int main() {
  int n, num, num1, times, y = 0;
  long long int t1 = 0, t2 = 0;
  int a[100005];
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &num);
    a[num] = i;
  }
  scanf("%d", &times);
  while (y < times) {
    scanf("%d", &num1);
    t1 += a[num1] + 1;
    t2 += n - a[num1];
    y++;
  }
  printf("%lld %lld", t1, t2);
  return 0;
}
