#include <bits/stdc++.h>
using namespace std;
long long exp(long long base, long long expz, long long mod) {
  long long res = 1;
  while (expz > 0) {
    if (expz % 2 == 1) res = (res * base) % mod;
    base = (base * base) % mod;
    expz /= 2;
  }
  return res % mod;
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long n;
  cin >> n;
  long long a[n], b[n];
  map<long long, long long> mp;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    mp[a[i]]++;
  }
  long long c = 0;
  for (long long i = 0; i < n; i++) {
    cin >> b[i];
    mp[b[i]]++;
    if (a[i] == b[i]) c++;
  }
  long long m;
  cin >> m;
  long long res = 1;
  long long fac[2 * n + 1];
  long long two[2 * n + 1];
  fac[0] = 1;
  two[0] = 0;
  for (long long i = 1; i < 2 * n + 1; i++) {
    long long num = i;
    two[i] = two[i - 1];
    while (num % 2 == 0) {
      num /= 2;
      two[i]++;
    }
    fac[i] = num * fac[i - 1];
    fac[i] %= m;
  }
  for (auto i : mp) {
    long long num = i.second;
    res *= fac[num];
    res %= m;
    if (c == 0) {
      res *= exp(2, two[num], m);
      res %= m;
      continue;
    }
    if (c >= two[num]) {
      c -= two[num];
    } else {
      long long op = two[num] - c;
      c = 0;
      res *= exp(2, op, m);
    }
    res %= m;
  }
  cout << res << "\n";
  return 0;
}
