#include<bits/stdc++.h>
using namespace std;
int main(){
long long a[100005],b,m,s1=0,s2=0;
int n;
cin>>n;
for(int i=0;i<n;i++){
cin>>b;
a[b]=i+1;
}
cin>>m;
while(m--){
int q;
cin>>q;
s1 = s1 + a[q];
s2 = s2 + n - a[q] +1;
//if(m!=0) cout<<" ";
}
cout<<s1<<" "<<s2<<"\n";
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCl7CgogICAgbG9uZyBsb25nIGFbMTAwMDA1XSxiLG0sczE9MCxzMj0wOwogICAgaW50IG47CiAgICBjaW4+Pm47CgogICAgZm9yKGludCBpPTA7aTxuO2krKyl7CiAgICAgICAgY2luPj5iOwogICAgICAgIGFbYl09aSsxOwogICAgfQoKICAgIGNpbj4+bTsKICAgIHdoaWxlKG0tLSl7CiAgICAgICAgaW50IHE7CiAgICAgICAgY2luPj5xOwoKICAgICAgICBzMSA9IHMxICsgYVtxXTsKCiAgICAgICAgczIgPSBzMiArIG4gLSBhW3FdICsxOwoKICAgICAgICAvL2lmKG0hPTApIGNvdXQ8PCIgIjsKCiAgICB9CgogICAgY291dDw8czE8PCIgIjw8czI8PCJcbiI7CgoKCiAgICByZXR1cm4gMDsKCn0K