#include <bits/stdc++.h>
int main() {
  long long int i, m, n, j, cnt1 = 0, cnt2 = 0, s;
  scanf("%I64d", &n);
  long long int arr[100002], a[100002];
  for (i = 1; i <= n; i++) {
    scanf("%I64d", &arr[i]);
    a[arr[i]] = i;
  }
  scanf("%I64d", &m);
  for (j = 1; j <= m; j++) {
    scanf("%I64d", &s);
    cnt1 += a[s];
  }
  int x = 0, y = 0;
  printf("%I64d %I64d", cnt1, m * (n + 1) - cnt1);
  return 0;
}
