#include <bits/stdc++.h>
using namespace std;
const double EPS = 0.0000001;
const double PI = acos(-1);
const long long INFLL = 0x7FFFFFFFFFFFFFFF;
const int INF = 0x7FFFFFFF;
template <typename T>
inline void next(T &num) {
  char c;
  num = 0;
  do {
    c = getchar_unlocked();
  } while (c != EOF && c == ' ' && c == '\n' && c == '\t');
  int sign = (c == '-' ? -1 : 1);
  if (c != '-') num += (c - '0');
  while ((c = getchar_unlocked()) != EOF && c != '\n' && c != '\t' &&
         c != ' ') {
    num *= 10;
    num += (c - '0');
  }
  num *= sign;
}
inline string getstr() {
  string str;
  char k;
  while ((k = getchar_unlocked()) == ' ' || k == '\n') {
    k = getchar_unlocked();
    if (k == ' ' || k == '\n')
      continue;
    else
      break;
  }
  str.push_back(k);
  while ((k = getchar_unlocked()) != EOF && k != '\n' && k != '\t' &&
         k != '\v' && k != '\0' && k != ' ')
    str.push_back(k);
  return str;
}
int n, a[200005], fac[200005], m, dewa = 0;
long long PLN(int base, int exp) {
  if (exp == 0)
    return 1LL;
  else {
    long long res = PLN(base, exp >> 1);
    res = (res * res) % m;
    if (exp & 1) res = (base * res) % m;
    return res;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = int(0), _b = int(2 * n - 1); i <= _b; i++) cin >> a[i];
  for (int i = int(0), _b = int(n - 1); i <= _b; i++)
    dewa += (a[i] == a[i + n]);
  sort(a, a + 2 * n);
  cin >> m;
  for (int l = 0, r = 0; l < 2 * n; l = r) {
    while (r < 2 * n && a[r] == a[l]) r++;
    if (r - l > 1) fac[r - l]++;
  }
  for (int i = int(2 * n), _b = int(2); i >= _b; i--) {
    fac[i] += fac[i + 1];
  }
  long long res = 1;
  for (int i = int(2 * n), _b = int(2); i >= _b; i--) {
    if ((i & 1) == 0 && dewa) {
      int mn = min(dewa, fac[i]);
      fac[i] -= mn;
      fac[i / 2] += mn;
      dewa -= mn;
    }
    res = (res * PLN(i, fac[i])) % m;
  }
  cout << res;
  return 0;
}
