import java.io.*;
import java.util.*;
import java.math.BigInteger;

public class derangements_as implements Runnable {

    public void solve() throws IOException {
        Scanner in = new Scanner(new File("derangements.in"));
        PrintWriter out = new PrintWriter(new File("derangements.out"));

        int n = in.nextInt();
        BigInteger[] fact = new BigInteger[n + 1];
        fact[0] = BigInteger.ONE;
        BigInteger[] two = new BigInteger[n + 1];
        two[0] = BigInteger.ONE;

        for (int i = 1; i <= n; i++) {
            fact[i] = fact[i - 1].multiply(BigInteger.valueOf(i));
            two[i] = two[i - 1].multiply(BigInteger.valueOf(2));
        }

        BigInteger res = BigInteger.ZERO;
        int s = 1;
        for (int i = 0; i <= n; i++) {
            if (s > 0) {
                res = res.add(fact[n].divide(fact[i]).multiply(two[n - i]));
            } else {
                res = res.subtract(fact[n].divide(fact[i]).multiply(two[n - i]));
            }
            s = -s;
        }

        out.println(res);

        in.close();
        out.close();
    }

    public void run() {
        try {
            solve();
        } catch (IOException e) {
            System.exit(64);
        }
    }

    public static void main(String[] arg) throws IOException {
        new Thread(new derangements_as()).start();
    }
}
