#include <bits/stdc++.h>
using namespace std;
long long int add(long long int a, long long int b,
                  long long int p = 1000000007) {
  a %= p;
  b %= p;
  return (a + b + p) % p;
}
long long int mul(long long int a, long long int b,
                  long long int p = 1000000007) {
  a %= p;
  b %= p;
  return (a * b + p) % p;
}
long long int power(long long int x, long long int n,
                    long long int p = 1000000007) {
  if (x == 0) return 0;
  if (n == 0 || x == 1) return 1LL;
  long long int r = (power(x, n / 2, p)) % p;
  if (n & 1)
    return mul(mul(r, r, p), x, p);
  else
    return mul(r, r, p);
}
int main() {
  long long int n, m;
  cin >> n;
  long long int a[n], d[100001] = {0};
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
    d[a[i]] += i;
  }
  cin >> m;
  long long int b, start = 0, end = n - 1, mid, t, v = 0, p = 0;
  for (long long int i = 0; i < m; i++) {
    cin >> b;
    v += d[b] + 1;
    p += n - d[b];
  }
  cout << v << " " << p;
}
