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