public long process() {
        Arrays.sort(_cards);
        for (int i = 0; i < _n; i++)
            if (_cards[i] > i)
                return 0;
        int start = 0;
        int end = 0;
        long prev = _cards[0];
        for (end = 1; end < _n; end++) {
            if (_cards[end] != prev)
                break;
        }
        long result = arrange(end, end);
        if (end < _n) {
            prev = _cards[end];
            start = end;
            for (; end < _n; end++) {
                if (_cards[end] != prev) {
                    result = (result * arrange(end - prev, end - start)) % MOD;
                    start = end;
                    prev = _cards[end];
                }
            }
            if (start != end) {
                result = (result * arrange(end - prev, end - start)) % MOD;
            }
        }

        return result;
    }