"use strict";
function main(input) {
  const n = parseInt(input[0]);
  let p = parseInt(input[1].trim().split(" ").join(""));
  let q = parseInt(input[2].trim().split(" ").join(""));

  const permutation = (nums, k) => {
    let ans = []
    if (nums.length < k) {
      return []
    }
    if (k===1) {
      for (let i=0;i<nums.length;i++) {
          ans[i] = [nums[i]];
      }
    } else {
      for (let i=0;i<nums.length;i++) {
        let parts = nums.slice(0);
        parts.splice(i, 1)[0];
        let row = permutation(parts, k - 1);
        for (let j=0;j<row.length;j++) {
          ans.push([nums[i]].concat(row[j]));
        }
      }
    }
    return ans;
  }

  let str = [];

  for(let i=1;i<=n;i++){
    str.push((i+""));
  }

  let all = permutation(str, n);
  let counter = 0;

  if(p!==q){
    for(let i=0;i<all.length;i++){
      let s = parseInt(all[i].join(""));
      if(((s>p) && (s<q)) || ((s<p) && (s>q))){
        counter++;
      }
    }
    console.log(counter+1);
  }else{
    console.log(0);
  }
  
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));