let () = Scanf.scanf "%d\n%s\n%s\n%s" @@ fun n a b c ->
  Printf.printf "%d\n" @@ Array.fold_left ( + ) 0 @@ Array.init n @@ fun i ->
    pred @@ List.length @@ List.sort_uniq compare [a.[i]; b.[i]; c.[i]]

