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