#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  scanf("%d", &n);
  map<int, int> N;
  for (int i = 0; i < n; i++) {
    unsigned long int k;
    std::cin >> k;
    N.insert(pair<int, int>(k, i));
  }
  long long a = 0, b = 0;
  scanf("%d", &m);
  int M[m];
  for (int i = 0; i < m; i++) {
    std::cin >> M[i];
  }
  for (int i = 0; i < m; i++) {
    unsigned long int k = N.at(M[i]);
    a = a + k + 1;
    b = b + n - k;
  }
  printf("%I64d %I64d\n", a, b);
  return 0;
}
