#include <bits/stdc++.h>
using namespace std;
inline bool checkBit(long long n, int i) { return n & (1LL << i); }
inline long long setBit(long long n, int i) {
  return n | (1LL << i);
  ;
}
inline long long resetBit(long long n, int i) { return n & (~(1LL << i)); }
int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
inline bool EQ2(double a, double b) { return fabs(a - b) < 1e-7; }
long long f[201000], g[201000], a[201000], b[201000];
map<int, int> cnt;
int main() {
  int n, divTwo = 0;
  cin >> n;
  long long ans = 1;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    cnt[a[i]]++;
  }
  for (int i = 0; i < n; ++i) {
    cin >> b[i];
    cnt[b[i]]++;
  }
  for (int i = 0; i < n; ++i) {
    divTwo += a[i] == b[i];
  }
  int m;
  cin >> m;
  f[0] = 1;
  g[0] = 0;
  for (int i = 1; i <= 2 * n + 100; ++i) {
    int x = i;
    while (x % 2 == 0) {
      x /= 2;
      ++g[i];
    }
    g[i] += g[i - 1];
    f[i] = (f[i - 1] * x) % m;
  }
  int total = 0;
  for (auto it : cnt) {
    ans *= f[it.second];
    ans %= m;
    total += g[it.second];
  }
  for (int i = 0; i < total - divTwo; ++i) ans = (ans * 2) % m;
  cout << ans;
  return 0;
}
