Problem:


Score : 200 points

Problem Statement

You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters.

Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation:

Operation: Choose one of the strings A, B and C, and specify an integer i between 1 and N (inclusive). Change the i-th character from the beginning of the chosen string to some other lowercase English letter.

What is the minimum number of operations required to achieve the objective?

Constraints

1 \leq N \leq 100

Each of the strings A, B and C is a string of length N.

Each character in each of the strings A, B and C is a lowercase English letter.

Input

Input is given from Standard Input in the following format:

N
A
B
C

Output

Print the minimum number of operations required.

Sample Input 1

4
west
east
wait

Sample Output 1

3

In this sample, initially A = west、B = east、C = wait. We can achieve the objective in the minimum number of operations by performing three operations as follows:

Change the second character in A to a. A is now wast.

Change the first character in B to w. B is now wast.

Change the third character in C to s. C is now wast.

Sample Input 2

9
different
different
different

Sample Output 2

0

If A, B and C are already equal in the beginning, the number of operations required is 0.

Sample Input 3

7
zenkoku
touitsu
program

Sample Output 3

13



Sample input:
4
west
east
wait


Sample output:
3

Submission status: Accepted

Solution code:
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def bisearch(L, target):
    low = 0
    high = len(L) - 1
    
    while low <= high:
        mid = (low + high) // 2
        guess = L[mid]
        if guess == target:
            return True
        elif guess < target:
            low = mid + 1
        elif guess > target:
            high = mid - 1
    if guess != target:
        return False

# --------------------------------------------

dp = None


def main():
    N = int(input())
    A = input()
    B = input()
    C = input()

    ans = 0

    for i in range(N):
        if A[i] == B[i] == C[i]:
            continue
        
        if A[i] == B[i] or A[i] == C[i] or B[i] == C[i]:
            ans += 1
        else:
            ans += 2

    print(ans)
        


main()

Submission status: Accepted

Solution code:
N = int(input())
A = input()
B = input()
C = input()
ans = 0
for i in range(N):
	s = set([A[i], B[i], C[i]])
	ans += len(s) - 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
A = input()
B = input()
C = input()

ans = 0 
for i in range(N):
  if A[i] == B[i] and B[i] == C[i]:
    ans += 0
  elif A[i] == B[i] or B[i] == C[i] or A[i] == C[i]:
    ans += 1
  else:
    ans += 2
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
from sys import stdin
# import numpy as np

s_in = lambda: stdin.readline()[:-1]  # s = s_in()
d_in = lambda: int(stdin.readline())  # N = d_in()
ds_in = lambda: list(map(int, stdin.readline().split()))  # List = ds_in()


N = d_in()
A = s_in()
B = s_in()
C = s_in()

ans = 0
for i in range(N):
    s = set([A[i], B[i], C[i]])
    ans += len(s) - 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
A = input()
B = input()
C = input()
Change = 0
for i in range(N):
    if A[i] == B[i] == C[i]:
        continue
    elif A[i] == B[i] or B[i] == C[i] or C[i] == A[i]:
        Change += 1
    else:
        Change += 2
print(Change)

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict
import math
def LI(): return list(map(int, input().split()))
def II(): return int(input())
def LS(): return input().split()
def S(): return input()
def IIR(n): return [II() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
mod = 1000000007

#A
"""
n,a,b = LI()
ans = [min(a,b),max(0,a+b-n)]
print(ans[0],ans[1])
"""

#B
n = II()
a = S()
b = S()
c = S()
ans = 0
for i in range(n):
    if a[i] == b[i]:
        if b[i] == c[i]:
            continue
        else:
            ans += 1
    else:
        if b[i] == c[i] or c[i] == a[i]:
            ans += 1
        else:
            ans += 2
print(ans)

#C

#D

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T

Submission status: Accepted

Solution code:
def ii():
    return int(input())
def mi():
    return map(int, input().split())
def li():
    return list(mi())

n = ii()
a, b, c = input().strip(), input().strip(), input().strip()
ans = 0
for i in range(n):
    if a[i] == b[i] and b[i] == c[i]:
        pass
    elif a[i] == b[i] or b[i] == c[i] or c[i] == a[i]:
        ans += 1
    else:
        ans += 2
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
n=int(input())
a,b,c=input(),input(),input()
count=0
for i in range(n):
    s=set([a[i],b[i],c[i]])
    if len(s)==3:
        count+=2
    elif len(s)==2:
        count+=1
print(count)

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n = I()
    a = [S() for _ in range(3)]
    r = n * 3
    for i in range(n):
        t = collections.defaultdict(int)
        for j in range(3):
            t[a[j][i]] += 1
        r -= max(t.values())

    return r



print(main())

Submission status: Accepted

Solution code:
N = int(input())
A=input()
B=input()
C=input()

res = 0
for i in range(N):
    st = set([])
    st.add(A[i])
    st.add(B[i])
    st.add(C[i])
    res+=len(st)-1
print(res)

Submission status: Accepted

Solution code:
N = input()
A = raw_input()
B = raw_input()
C = raw_input()
ans = 0

for i in xrange(N-1, -1, -1):
    S = set([A[i], B[i], C[i]])
    if len(S) == 2:
        ans += 1
    elif len(S) == 3:
        ans += 2

print ans

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n = int(input())
a = input()
b = input()
c = input()
cnt = 0
for i in range(n):
    if a[i] == b[i] == c[i]:
        pass
    elif a[i] == b[i] or b[i] == c[i] or c[i] == a[i]:
        cnt += 1
    else:
        cnt += 2
print(cnt)

Submission status: Accepted

Solution code:
n=int(input())
a=input()
b=input()
c=input()

co=0
for i in range(n):
    if a[i]==b[i] and b[i]==c[i]:
        co+=0
    elif a[i]==b[i] or b[i]==c[i] or c[i]==a[i] :
        co+=1
    else :
        co+=2

print(co)

Submission status: Accepted

Solution code:
def read():
    return int(input())


def readlist():
    return list(map(int, input().split()))


def readmap():
    return map(int, input().split())


N = read()
A = input()
B = input()
C = input()

cnt = 0
for i in range(N):
    if len({A[i], B[i], C[i]}) == 1:
        pass
    elif len({A[i], B[i], C[i]}) == 2:
        cnt += 1
    else:
        cnt += 2

print(cnt)

Submission status: Accepted

Solution code:
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict, Counter
from bisect import bisect

setrecursionlimit(10**7)

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

N = read()
A = input()
B = input()
C = input()

c = 0

for i in range(N):
  s = {A[i], B[i], C[i]}
  if len(s) == 2:
    c += 1
  elif len(s) == 3:
    c += 2

print(c)

Submission status: Accepted

Solution code:
N=int(input())
A=input()
B=input()
C=input()
ans=0
for i in range(N):
    S=set([A[i],B[i],C[i]])
    if len(S)==1:
        continue
    elif len(S)==2:
        ans+=1
    else:
        ans+=2
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
A = input()
B = input()
C = input()

ans = 0
for a, b, c in zip(A, B, C):
    if a == b == c:
        continue
    if a == b or b == c or c == a:
        ans += 1
    else:
        ans += 2
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
a, b, c = input(), input(), input()
ans = 0
for i in range(n):
  ans += len(set(a[i], b[i], c[i])) - 1
print(ans)

Submission status: Runtime Error

Solution code:
from sys import stdin
N = int(stdin.readline().rstrip())
A = stdin.readline().rstrip()
B = stdin.readline().rstrip()
C = stdin.readline().rstrip()
ans = 0 
for i in range(N):
    ans += len(set(A[i], B[i], C[i]))-1
print(ans)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()

#####Shorten#####
def DD(arg): return defaultdict(arg)


#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

#####MakePrimes######
def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum

#####GCD#####
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############

N = I()
A,B,C = SLs(3)

def kyori(S,T):
  ret = 0
  for i in range(N):
    if S[i]!=T[i]:
      ret += 1
  return ret
print(sum(kyori(A,B),kyori(A,C),kyori(B,C))-max(kyori(A,B),kyori(A,C),kyori(B,C)))

Submission status: Runtime Error

Solution code:
n = int(input())
ans = 0
a = input()
b = input()
c = input()
for i in n:
  if a[i] == b[i] == c[i]:
    pass
  elif a[i] == b[i] or a[i] == c[i] or a[i] == c[i]:
    ans += 1
  else:
    ans += 2
print(ans)

Submission status: Runtime Error

Solution code:
Npt

Submission status: Runtime Error

Solution code:
n = int(input())
a = input()
b = input()
c = input()
ans = 0
for i,j,k in zip(a,b,c):
  ans += len(set(i,j,k))-1
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
L = []
for i in range(n):
    L.append(input())

def num(a,b,c):
    s = {a,b,c}
    return len(s)-1
cnt = 0
for i in range(n):
    cnt += num(L[0][i],L[1][i],L[2][i])
print(cnt)

Submission status: Runtime Error

Solution code:
#coding:utf-8
n = int(input())
a = input()
b = input()
c = input()
ans = 0

for i in range(n):
  ans += len(set(a[i], b[i], c[i])) - 1 
  
print(ans)

Submission status: Runtime Error

Solution code:
#coding:utf-8
n = int(input())
a, b, c = map(str, input().split())
ans = 0

for i in range(n):
  ans += len(set(a[i], b[i], c[i])) - 1 
  
print(ans)

Submission status: Runtime Error

Solution code:
# coding: utf-8
import re
import math
import itertools
from copy import deepcopy
import random
from heapq import heappop,heappush
import time
import os
import queue
import sys
import datetime
from functools import lru_cache
readline=sys.stdin.readline
sys.setrecursionlimit(2000)
#import numpy as np
alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
week=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def is_power(a,b):#aはbの累乗数か
    now=b
    while now<a:
        now*=b
    if now==a:return True
    else:return False
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def facs(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod_>0):A[a]%=mod_
    return A
def comb(n,r,mod_,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod_-2,mod_)*pow(fac[r],mod_-2,mod_))%mod_
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(a,b,c):
    if a:return b
    else:return  c
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
def factorize(n,type_="dict"):
    b = 2
    list_ = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            list_.append(b)
        b+=1
    if n > 1:list_.append(n)
    if type_=="dict":
        dic={}
        for a in list_:
            if a in dic:
                dic[a]+=1
            else:
                dic[a]=1
        return dic
    elif type_=="list":
        return list_
    else:
        return None
def floor_(n,x=1):
    return x*(n//x)
def ceil_(n,x=1):
    return x*((n+x-1)//x)
#################################### ########
# coding: utf-8
import re
import math
import itertools
from copy import deepcopy
import random
from heapq import heappop,heappush
import time
import os
import queue
import sys
import datetime
from functools import lru_cache
readline=sys.stdin.readline
sys.setrecursionlimit(2000)
#import numpy as np
alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def is_power(a,b):#aはbの累乗数か
    now=b
    while now<a:
        now*=b
    if now==a:return True
    else:return False
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def get_facs(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(a,b,c):
    if a:return b
    else:return  c
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
def factorize(n,type_="dict"):
    b = 2
    list_ = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            list_.append(b)
        b+=1
    if n > 1:list_.append(n)
    if type_=="dict":
        dic={}
        for a in list_:
            if a in dic:
                dic[a]+=1
            else:
                dic[a]=1
        return dic
    elif type_=="list":
        return list_
    else:
        return None
def floor_(n,x=1):
    return x*(n//x)
def ceil_(n,x=1):
    return x*((n+x-1)//x)
###################################################
def main():
    N=int(input())
    A=int(input())
    B=int(input())
    C=int(input())
    ans=0
    for a in range(N):
        s=A[a]+B[a]+C[a]
        length=len(set(s))
        ans=length-1
    print(ans)


main()

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(input())
b = list(input())
c = list(input())

ans = 0
for i in range(n):
  aa = a[i]
  bb = b[i]
  cc = c[i]
  if len(set([a,b,c])) == 1:
    continue
  elif len(set([a,b,c])) == 2:
    ans += 1
  else:
    ans += 2
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
s = [input() in range(3)]
ans = 2*n
for i in range(n):
  if s[0][i] == s[1][i]: ans -= 1
  if s[0][i] == s[2][i]: ans -= 1
  if s[2][i] == s[1][i]: ans -= 1
  if s[0][i] == s[1][i] and s[2][i] == s[1][i] : ans += 1
print(ans)

Submission status: Runtime Error

Solution code:
n=int(input())
a=input()
b=input()
c=input
ans=0
for i in range(n):
  m=len(set([a[i],b[i],c[i]]))
  ans+=m-1
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
2 A, B, C = input(), input(), input()
3 ans = 0
4 for i in range(N):
5 ans += len(set([A[i], B[i], C[i]])) - 1
6 print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
A = [input() for i in range(N)]
ans = 0
for i in range(N):
  ans += len(set(A[0][i],A[1][i],A[2][i]))-1
print(ans)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n=int(input())
a,b,c=[input() for i in range(3)]
for i in range(n):
  ans += len(set(a[i],b[i],c[i])) - 1
print(ans)

Submission status: Runtime Error

Solution code:
n=int(input())
l=[input(),input(),input()]
c=0
for x in zip(*l):
  if len(set(x))==3:
    c+=2
  elif len(et(x))==2:
    c+=1
print(c)

Submission status: Runtime Error

Solution code:
N = int(input())
A = input()
B = input()
C = input()
ans = 0
for i in range(N):
	ans += len(set(A[i],B[i],C[i])) - 1
print(ans)

Submission status: Runtime Error

Solution code:
n=int(input())
a,b,c=input().split()
ab=0;bc=0;ca=0
for i in range(n):
  if a[i]!=b[i]:
    ab+=1
  if b[i]!=c[i]:
    bc+=1
  if c[i]!=a[i]:
    ca+=1
print(min(ab,bc,ca))

Submission status: Runtime Error

Solution code:
n=int(input())
a,b,c=input().split()
ab,bc,ca=0,0,0
for i in range(n):
  if a[i]!=b[i]:
    ab+=1
  if b[i]!=c[i]:
    bc+=1
  if c[i]!=a[i]:
    ca+=1
print(min(ab,bc,ca))

Submission status: Runtime Error

Solution code:
N,A,B,C=[input() for i in range(4)]
ans=0
for i in range(N):
    if A[i]!=B[i] and A[i]!=C[i] and B[i]!=C[i]:
        ans+=2
    elif A[i]!=B[i] or A[i]!=C[i]:
        ans+=1
print(ans)

Submission status: Runtime Error

Solution code:
N=int(input())
A=input()
B=input()
C=input()
ans=0
for i in range(N):
  ans+=len(set(A[i],B[i],C[i]))-1
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
a = input()
b = input()
c = input()
cnt2 = 0
cnt3 = 0
for i in range(n):
  nsame = len(set([a[i], b[i], c[i]]))
    if nsame == 2:
      cnt2 += 1
    elif nsame == 1:
      cnt3 += 1
ans = 2*n - cnt2 - 2*cnt3
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
a = input()
b = input()
c = input()
cnt2 = 0
cnt3 = 0
for i in range(n):
  nsame = len(set([a[i], b[i], c[i]])):
    if nsame == 2:
      cnt2 += 1
    elif nsame == 1:
      cnt3 += 1
ans = 2*n - cnt2 - 2*cnt3
print(ans)

Submission status: Runtime Error

Solution code:
n = map(int, raw_input())
a = []
for _ in range(3):
  a.append(raw_input())
ans = 0
for i in range(n):
  diff_chars = set()
  for j in range(3):
    diff_chars.add(a[j][i])
  ans += len(diff_chars) - 1
print ans

Submission status: Runtime Error

Solution code:
import sys

n=int(input())
for _ in range(n):
    a=input()
    b=input()
    c=input()


cnt = 0
for i in range(n):
    if a[i] == b[i] == c[i]:
        continue
    elif a[i] == b[i] or b[i] == c[i] or c[i] == a[i]:
        cnt = cnt + 1
    else:
        cnt = cnt + 2
print(cnt)

Submission status: Runtime Error

Solution code:
import sys

n=int(sys.stdin.readline())
for _ in range(n):
    a=sys.stdin.readline()
    b=sys.stdin.readline()
    c=sys.stdin.readline()


cnt = 0
for i in range(n):
    if a[i] == b[i] == c[i]:
        continue
    elif a[i] == b[i] or b[i] == c[i] or c[i] == a[i]:
        cnt = cnt + 1
    else:
        cnt = cnt + 2
print(cnt)

Submission status: Runtime Error

Solution code:
import sys

n=int(sys.stdin.readline())
M=[]
for _ in range(n):
    M.append(sys.stdin.readline())

cnt = 0
for i in range(n):
    if M[0][i] == M[1][i] == M[2][i]:
        continue
    elif M[0][i] == M[1][i] or M[1][i] == M[2][i] or M[2][i] == M[0][i]:
        cnt = cnt + 1
    else:
        cnt = cnt + 2
print(cnt)

Submission status: Runtime Error

Solution code:
import sys

n=int(sys.stdin.readline())
M=[]
for _ in range(n):
    M.append(sys.stdin.readline())

cnt = 0
for i in range(n):
    tmp = 0
    if M[0][i] != M[1][i]:
        tmp = tmp + 1
    if M[0][i] != M[2][i]:
        tmp = tmp + 1
    if M[1][i] == M[2][i] and tmp == 2:
        tmp = tmp - 1
    cnt = cnt + tmp
print(cnt)

Submission status: Runtime Error

Solution code:
totalcount=0
for i in range(n):
    count=2
    if a[i] == b[i]:
        count=1
        if  b[i]==c[i]:
            count=0
    elif a[i] == c[i]:
        count=1
    elif b[i]==c[i]:
        count=1
    totalcount+=count
print(totalcount)

Submission status: Runtime Error

Solution code:
n = int(input())
a = input()
b = input()
c = input()

ans = 0
for i in range(n):
  cnt = len(set(a[i],b[i],c[i]))-1
  ans += cnt

print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
a,b,c = input(),input(),input()

ans = 0
for i in range(n):
	cnt = len(set(a[i],b[i],c[i]))-1
	ans += cnt

print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
a,b,c = input(),input(),input()

ans = 0
for i in range(n):
  cnt = len(set(a[i],b[i],c[i]))-1
  ans += cnt

print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
a,b,c = input(),input(),input()

ans = 0
for i in range(n):
  cnt = len(set(a[i],b[i],c[i]))-1
  ans += cnt

print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
a = input()
b = input()
c = input
count = 0

for i in range(n):
    if a[i] != b[i]:
        count += 1
    if b[i] != c[i]:
        count += 1
    if c[i] != a[i]:
        count += 1
print(count)

Submission status: Runtime Error

Solution code:
n = int(input())
a,b,c = input(),input(),input()

count = 0
for i in range(n):
    count += len(set(a[i],b[i],c[i]))-1
print(count)

Submission status: Runtime Error

Solution code:
from statistics import mode
n = int(input())
a = list(input())
b = list(input())
c = list(input())
ans = 0
for i in range(n):
    k = [a[i], b[i], c[i]]
    if len(set(k)) != 3:
        flag = mode(k)
        ans += 3-k.count(flag)
    else:
        ans += 2

print(ans)

Submission status: Runtime Error

Solution code:
n=int(input())
a,b,c=input(),input(),input()
ct=0
for i in range(n):
  if a[i]==b[i]==c[i]:ct+=0
  elif a[i]==b[i] or b[i]==c[i] or c[i]==a[i]:ct+=1
  else:ct+=2
print(ct)​

Submission status: Runtime Error

Solution code:
n = int(input())

a = input()
b = input()
c = input()

ans = 0

if a == b & b == c:
    ans = 0
else:
    for count in range(n):
        tmp = 0
        if a[count] == b[count]:
            if a[count] != c[count]:
                tmp += 1
        else:
            tmp += 1
            if (a[count] != c[count]) & (b[count] != c[count]):
                tmp += 1
        ans += tmp
    
print(ans)

Submission status: Runtime Error

Solution code:
N, A, B, C = input().split()
count = 0
for i in range(int(N)):
    if (A[i] != B[i])&(A[i] !=C[i]):
        B[i] == A[i]
        count = 1 + count
        if A[i] != C[i]:
            C[i] == A[i]
            count = 1 + count

        else:
            continue
    elif A[i] != C[i]:
        C[i] == A[i]
        count = count + 1
    else:
        continue

print(count)

Submission status: Runtime Error

Solution code:
N, A, B, C = input().split()
count = 0
for i in range(int(N)):
    if (A[i] != B[i])&(A[i] !=C[i]):
        B[i] == A[i]
        count = 1 + count
        #print(count,l[2])
        if A[i] != C[i]:
            C[i] == A[i]
            count = 1 + count
            #print(count, l[3])
        else:
            continue
    elif A[i] != C[i]:
        C[i] == A[i]
        count = count + 1
        #print(count, l[3])
    else:
        continue

print(count)

Submission status: Runtime Error

Solution code:
N, l = input().split()   
count = 0
for i in range(N):
    if (l[1][i] != l[2][i])&(l[1][i] != l[3][i]):
        l[2][i] == l[1][i]
        count = 1 + count
        #print(count,l[2])
        if l[1][i] != l[3][i]:
            l[3][i] == l[1][i]
            count = 1 + count
            #print(count, l[3])
        else:
            continue
    elif l[1][i] != l[3][i]:
        l[3][i] == l[1][i]
        count = count + 1
        #print(count, l[3])
    else:
        continue

print(count)