#include <bits/stdc++.h>
using namespace std;
float r(float var) {
  float value = (int)(var * 100 + .5);
  return (float)value / 100;
}
void solve() {
  int64_t n;
  cin >> n;
  unordered_map<int64_t, int64_t> mp;
  for (int64_t i = 0; i < n; i++) {
    int64_t temp;
    cin >> temp;
    mp[temp] = i;
  }
  int64_t m;
  cin >> m;
  int64_t v = 0, p = 0;
  for (int64_t i = 0; i < m; i++) {
    int64_t num;
    cin >> num;
    if (mp.find(num) != mp.end()) {
      v += mp[num] + 1;
      p += n - mp[num];
    }
  }
  cout << v << " " << p;
}
int main() {
  solve();
  return 0;
}
