Counting Magical Permutatitons

Problem Name:
Counting Magical Permutatitons
Site:Spoj
Links:
Tags:
Problem setters: