We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Hiring developers?
  1. Prepare
  2. Security
  3. Terminology and Concepts
  4. Security Encryption Scheme

Security Encryption Scheme

Problem
Submissions
Leaderboard
Discussions
  1. Prepare
  2. Security
  3. Terminology and Concepts
  4. Security Encryption Scheme
Exit Full Screen View
  • Problem
  • Submissions
  • Leaderboard
  • Discussions

An encryption scheme consists of a set and a corresponding set of encrypting and decrypting functions, respectively.
For each , there is a unique key where .
An encryption scheme is also called a cipher.

It should be clear that every is actually a representative of some bijection from to . In this task, you have to count the number of such bijections and, hence, the number of keys that produce different encryption functions.

Assume that which is given as the input.

Constraints

Input Format

The input consists of a single positive integer .

Output Format

Output a single positive integer, the number of bijections.

Sample Input

3

Sample Output

6

Explanation

Let us assume that and .

We can have encryption schemes where can be mapped to or or , can be mapped to the remaining two, and can be mapped to the unmapped one.

This accounts for such encryption functions.

  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy