#include <bits/stdc++.h>
using namespace std;
const int MAX = 100005;
int A[MAX];
int main() {
  int n, aux, m;
  long long ansv = 0, ansp = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &aux);
    A[aux] = i + 1;
  }
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    scanf("%d", &aux);
    ansv += A[aux];
    ansp += (n - A[aux]) + 1;
  }
  printf("%I64d %I64d\n", ansv, ansp);
  return 0;
}
