#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 9;
long long a[MAX], n, m, b[MAX], cnt, ans = 1;
map<long long, long long> mp;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i], mp[a[i]]++;
  for (int i = 0; i < n; i++) cin >> b[i], cnt += (b[i] == a[i]), mp[b[i]]++;
  cin >> m;
  for (auto i : mp)
    for (int j = 1; j <= i.second; j++) {
      long long x = j;
      while (cnt > 0 && x % 2 == 0) x /= 2, cnt--;
      ans = ans * x % m;
    }
  cout << ans % m;
}
