#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
int n, m, c = 1, two, idx = 0;
pair<int, int> a[N];
long long ans = 1;
int main(int argc, char **argv) {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[idx].first);
    a[idx].second = i;
    ++idx;
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[idx].first);
    a[idx].second = i;
    ++idx;
  }
  scanf("%d", &m);
  sort(a, a + n + n);
  for (int i = 1; i <= n + n; ++i) {
    if (a[i] == a[i - 1]) ++two;
    if (a[i].first == a[i - 1].first)
      ++c;
    else {
      for (int x, j = 1; j <= c; ++j) {
        x = j;
        while ((!(x & 1)) && two) x >>= 1, --two;
        ans = ans * x % m;
      }
      c = 1;
      two = 0;
    }
  }
  cout << ans << endl;
  return 0;
}
