#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
int mod, need = 0;
int mul(int a, int b) { return (long long)a * b % mod; }
int my_factorial(int n) {
  int ans = 1;
  for (int i = 1; i <= int(n); i++) {
    int x = i;
    while (x % 2 == 0 && need > 0) {
      x /= 2;
      need--;
    }
    ans = mul(ans, x);
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<pair<int, int> > a(2 * n);
  for (int i = 0; i < int(2 * n); i++) {
    cin >> a[i].first;
    a[i].second = i % n;
  }
  cin >> mod;
  sort(a.begin(), a.end());
  for (int i = 0; i < int(2 * n - 1); i++)
    if (a[i] == a[i + 1]) need++;
  int ans = 1;
  for (int i = 0, j = 0; i < 2 * n; i = j) {
    while (j < 2 * n && a[i].first == a[j].first) {
      j++;
    }
    ans = mul(ans, my_factorial(j - i));
  }
  cout << ans << endl;
}
