#include <bits/stdc++.h>
using namespace std;
int i, n, k, a[200010], b[200010], MOD, sol, d, x, j;
int main() {
  cin >> n;
  d = 0;
  for (i = 1; i <= 2 * n; i++) {
    cin >> a[i];
    if (i > n and a[i] == a[i - n]) d++;
  }
  cin >> MOD;
  n = 2 * n;
  sort(a + 1, a + n + 1);
  k = 0;
  for (i = 1; i <= n; i++) {
    if (a[i] != a[i - 1]) k++;
    b[k]++;
  }
  sol = 1;
  for (i = 1; i <= k; i++) {
    for (j = 1; j <= b[i]; j++) {
      x = j;
      while (x % 2 == 0 and d) {
        d--;
        x /= 2;
      }
      sol = ((long long)sol * x) % MOD;
    }
  }
  cout << sol << "\n";
  return 0;
}
