#include <bits/stdc++.h>
void P_1_30() {
  std::unordered_map<int, int> elemToIndex;
  int n;
  std::cin >> n;
  for (int i = 1; i <= n; i++) {
    int e;
    std::cin >> e;
    elemToIndex[e] = i;
  }
  int m;
  std::cin >> m;
  long long opCount = 0, opCountReverse = 0;
  for (int i = 0; i < m; i++) {
    int q;
    std::cin >> q;
    int index = elemToIndex[q];
    opCount += index;
    opCountReverse += (n - index + 1);
  }
  std::cout << opCount << " " << opCountReverse;
}
int main() { P_1_30(); }
