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