#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
template <typename T>
T modpow(T base, T exp, T modulus) {
  base %= modulus;
  T result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % modulus;
    base = (base * base) % modulus;
    exp >>= 1;
  }
  return result;
}
string decToBinary(long long int n) {
  string r = "";
  for (long long int i = 31; i >= 0; i--) {
    long long int k = n >> i;
    if (k & 1)
      r = r + "1";
    else
      r = r + "0";
  }
  return r;
}
long long int bintodec(long long int a[32]) {
  long long int s = 0, c = 0;
  for (long long int i = 31; i >= 0; i--) {
    if (a[i]) s = s + pow(2, c);
    c++;
  }
  return s;
}
bool isPrime(long long int n) {
  if (n == 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0) return false;
  for (int i = 3; i <= sqrt(n); i = i + 2)
    if (n % i == 0) return false;
  return true;
}
void solve() {
  long long int n;
  cin >> n;
  long long int a[n];
  map<long long int, long long int> m;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
    m[a[i]] = i + 1;
  }
  long long int M;
  cin >> M;
  long long int c = 0, s = 0;
  while (M--) {
    long long int p;
    ;
    cin >> p;
    s = s + m[p];
    c = c + n - m[p] + 1;
  }
  cout << s << " " << c << "\n";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  { solve(); }
  return 0;
}
