#include <bits/stdc++.h>
using namespace std;
vector<int> M;
int n, m, x;
long long res, y;
int main() {
  cin >> n;
  M.resize(2 * n);
  for (int i = 0; i < n; ++i) scanf("%d", &M[i]);
  for (int i = n; i < 2 * n; ++i) {
    scanf("%d", &M[i]);
    if (M[i] == M[i - n]) ++x;
  }
  cin >> m;
  sort(M.begin(), M.end());
  res = 1;
  y = 1;
  for (int i = 1; i < 2 * n; ++i) {
    if (M[i] == M[i - 1]) {
      res *= (++y);
      while (x && !(res % 2)) {
        res /= 2;
        --x;
      }
      res %= m;
    } else
      y = 1;
  }
  cout << res << "\n";
}
