解析:
a[ i ] ^ b[ j ] = a[ j ] ^ b[ i ] 可得 a[ i ] ^ b[ i ] = a[ j ] ^ b[ j ] ,所以统计相同的异或值即可
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=3e5+5;
int n,a[N],b[N];
void solve(){
scanf("%lld",&n);
for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
for(int i=1;i<=n;i++) scanf("%lld",&b[i]);
map<int,int>mp;
int res=0;
for(int i=1;i<=n;i++){
int x=a[i]^b[i];
res+=mp[x];
mp[x]++;
}
printf("%lld",res*2+n);
}
signed main(){
int t=1;
// scanf("%d",&t);
while(t--) solve();
return 0;
}