It giving me some garbage value

would you please tell me whats wrong in this code it giving me some garbage value every time.

#include
using namespace std;
int findOdd(int arr[], int n) {
int res = 0, i;
for (i = 0; i < n; i++)
res ^= arr[i];
return res;
}
int main() {
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[n];
}
cout<<findOdd(arr,n);
return 0;
}

@Himanshu0123 hey himanshu it should be cin>>arr[i];