#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int MOD = 1e9 + 7;
int n, m, ar[200000], two = 0;
map<pair<int, int>, int> cnt;
int main() {
  scanf("%d", &n);
  for (int(i) = 0; (i) < (n); (i)++) {
    scanf("%d", &ar[i]);
    cnt[{ar[i], i}]++;
  }
  for (int(i) = 0; (i) < (n); (i)++) {
    scanf("%d", &ar[n + i]);
    cnt[{ar[n + i], i}]++;
  }
  scanf("%d", &m);
  for (auto it : cnt) two += (it.second > 1);
  n *= 2;
  sort(ar, ar + n);
  long long an = 1, cur = 1;
  for (int(i) = (1); (i) <= (n - 1); (i)++) {
    if (ar[i] == ar[i - 1])
      cur++;
    else
      cur = 1;
    long long now = cur;
    for (; two && now % 2 == 0; two--, now = now / 2)
      ;
    an = (an * now) % m;
  }
  printf("%lld\n", an);
  return 0;
}
