#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int a[n + 1], pos[n + 1];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    pos[a[i]] = i;
  }
  int m;
  cin >> m;
  int b[m + 1];
  long long Vasya = 0, Petya = 0;
  for (int i = 1; i <= m; i++) {
    cin >> b[i];
    Vasya += pos[b[i]];
    Petya += n - pos[b[i]] + 1;
  }
  printf("%lld %lld", Vasya, Petya);
  return 0;
}
