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