#include <bits/stdc++.h>
using namespace std;
int a[200005];
int main() {
  int n;
  cin >> n;
  int d = 0;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    cin >> a[i + n];
    if (a[i] == a[i + n]) d++;
  }
  int m;
  cin >> m;
  sort(a, a + 2 * n);
  int c = 1;
  long long ans = 1;
  for (int i = 0; i < 2 * n; i++) {
    if (a[i - 1] == a[i]) {
      c++;
      ans *= c;
      while (d > 0 && ans % 2 == 0) {
        d--;
        ans /= 2;
      }
      ans %= m;
    } else
      c = 1;
  }
  cout << ans << endl;
  return 0;
}
