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