#include <bits/stdc++.h>
using namespace std;
int a[100005];
int l[100005], r[100005];
int main() {
  int n;
  cin >> n;
  long long lans = 0;
  long long rans = 0;
  memset(l, 0, sizeof(l));
  memset(r, 0, sizeof(r));
  for (long long i = (0); i < (n); i++) {
    cin >> a[i];
    if (!l[a[i]]) l[a[i]] = i + 1;
    r[a[i]] = i + 1;
  }
  for (long long i = (0); i < (n + 1); i++) {
    if (l[i] == 0) l[i] = n;
    if (r[i] == 0) r[i] = 1;
  }
  int m;
  cin >> m;
  int c;
  for (long long i = (0); i < (m); i++) {
    cin >> c;
    lans += l[c];
    rans += n + 1 - r[c];
  }
  cout << lans << " " << rans << endl;
  return 0;
}
