#include <bits/stdc++.h>
using std::sort;
int main() {
  int n, m;
  assert(scanf("%d", &n) == 1);
  int a[2 * n], *b = a + n;
  for (int i = 0; i < 2 * n; i++) assert(scanf("%d", &a[i]) == 1);
  int t = 0;
  for (int i = 0; i < n; i++) t += (a[i] == b[i]);
  assert(scanf("%d", &m) == 1);
  sort(a, a + 2 * n);
  int k = 0, c = -1;
  long long ans = 1;
  for (int i = 0; i < 2 * n; i++) {
    if (c == a[i]) {
      k++;
    } else {
      c = a[i];
      k = 1;
    }
    int j = k;
    while (t > 0 && j % 2 == 0) t--, j /= 2;
    ans = (ans * j) % m;
  }
  assert(t == 0);
  printf("%d\n", (int)ans);
  return 0;
}
