#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long n;
  cin >> n;
  unsigned long long x[n + 5];
  for (unsigned long long i = 1; i <= n; i++) {
    unsigned long long c;
    cin >> c;
    x[c] = i;
  }
  unsigned long long m;
  cin >> m;
  unsigned long long sum = 0;
  unsigned long long sum2 = 0;
  for (unsigned long long i = 1; i <= m; i++) {
    unsigned long long d;
    cin >> d;
    sum += x[d];
    sum2 += ((n - x[d]) + 1);
  }
  cout << sum << " " << sum2 << endl;
  return 0;
}
