#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int index[100010] = {0};
  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    index[tmp] = i;
  }
  int m;
  cin >> m;
  unsigned long long int a, b;
  a = b = 0;
  for (int i = 0; i < m; i++) {
    int srch;
    cin >> srch;
    int j = index[srch];
    a += j + 1;
    b += n - j;
  }
  cout << a << " " << b << endl;
  return 0;
}
