#include <bits/stdc++.h>
using namespace std;
const long long MAX = 2500000000;
const int inf = 123456789;
const double EPS = 1e-9;
const double PII = 2 * asin(1.0);
const long long mod = 1e9 + 7;
int double_cmp(double x, double y = 0, double tol = EPS) {
  return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
}
map<int, long long> mapa;
set<pair<int, int> > pares;
long long cont;
int main() {
  int n;
  scanf("%d", &n);
  cont = 0;
  for (int i = 0; i < n; ++i) {
    int a;
    scanf("%d", &a);
    pares.insert(make_pair(a, i));
    mapa[a]++;
  }
  for (int i = 0; i < n; ++i) {
    int a;
    scanf("%d", &a);
    if (pares.find(make_pair(a, i)) != pares.end()) cont++;
    mapa[a]++;
  }
  long long m;
  cin >> m;
  long long saida = 1LL;
  for (auto i : mapa) {
    for (long long j = 2LL; j <= i.second; j++) {
      long long x = j;
      while (x % 2 == 0 && cont > 0) {
        x /= 2;
        cont--;
      }
      saida *= x;
      saida %= m;
    }
  }
  cout << saida << endl;
}
