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:
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: Accepted

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: Accepted

Solution code:
n = int(input())
a = input()
b = input()
c = input()
count = 0
for i in range(n):
    ai = a[i]
    bi = b[i]
    ci = c[i]
    if ai != bi and bi != ci and ai != ci:
        count += 2
    elif ai == bi and bi == ci and ai == ci:
        continue
    else:
        count +=1
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

res = 0
for i in range(n):
    chrs = set([a[i], b[i], c[i]])
    if len(chrs) == 1:res += 0
    if len(chrs) == 2:res += 1
    if len(chrs) == 3:res += 2

print(res)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    A = input()
    B = input()
    C = input()
    retval = 0
    for i in range(N):
        diff = 0
        if A[i] != B[i]:
            diff += 1
        if B[i] != C[i]:
            diff += 1
        if C[i] != A[i]:
            diff += 1
        if diff >= 1:
            retval += diff - 1
    print(retval)


if __name__ == "__main__":
    main()

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] and B[i] != C[i] \
        or B[i] == C[i] and C[i] != A[i] \
        or C[i] == A[i] and A[i] != B[i]:
        ans += 1
    else:
        ans += 2

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
ABC = [input() for i in range(3)]
ans = 0
for i in range(N):
    a = ABC[0][i]
    b = ABC[1][i]
    c = ABC[2][i]
    if a == b and b == c:
        continue
    if a != b and a != c and b != c:
        ans += 2
        continue
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
A = input()
B = input()
C = input()
ans = 0
for k in range(N):
    a, b, c = A[k], B[k], C[k]
    if a == b == c:
        ans += 0
    elif a == b and b != c:
        ans += 1
    elif a == c and c != b:
        ans += 1
    elif b == c and b != a:
        ans += 1
    else:
        ans += 2

print(ans)

Submission status: Accepted

Solution code:
def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import Counter
N = int(input())
A = input()
B = input()
C = input()
ans = 0
for i in range(N):
    c = Counter([A[i], B[i], C[i]])
    ans += 3 - max(x for x in c.values())
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

l = int(input())
s = [input() for _ in range(3)]

ans = 0
for a, b, c in zip(*s):
    if a == b == c:
        pass
    elif a == b or b == c or c == a:
        ans += 1
    else:
        ans += 2

print(ans)

Submission status: Accepted

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

count = 0
for i in range(N):
    if A[i] == B[i]:
        if B[i] != C[i]:
            count += 1
    else:
        if A[i] == C[i]:
            count += 1
        elif B[i] == C[i]:
            count += 1
        else:
            count += 2

print(count)

Submission status: Accepted

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

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]==C[i]:
    ans+=0
  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:
n = int(input())
a = list(input())
b = list(input())
c = list(input())

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

print(res)

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]==c[i]:
        ans+=0
    elif a[i]==b[i]:
        ans+=1
    elif b[i]==c[i]:
        ans+=1
    elif a[i]==c[i]:
        ans+=1
    else:
        ans+=2
print(ans)

Submission status: Accepted

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

    ans = 0
    for i in range(N):
        a = A[i]
        b = B[i]
        c = C[i]

        s = {a, b, c}
        if len(s) == 3:
            ans += 2
        elif len(s) == 2:
            ans += 1

    return ans


def main():
    ans = solve()
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

ans = 0

for i in range(N):
    a = A[i]
    b = B[i]
    c = C[i]

    s = set()
    s.add(a)
    s.add(b)
    s.add(c)

    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] == C[i]:
    continue
  elif A[i] != B[i] and A[i] != C[i] and B[i] != C[i]:
    ans += 2
  else:
    ans += 1
    
print(ans)

Submission status: Accepted

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

ans = 0
for i in range(n):
    s = len(set((a[i], b[i], c[i])))
    if s == 1:
        pass
    if s == 2:
        ans += 1
    if s == 3:
        ans += 2

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]:
        if B[i] == C[i]:
            pass
        else:
            ans += 1
    else:
        if B[i] == C[i]:
            ans += 1
        elif A[i] == C[i]:
            ans += 1
        else:
            ans += 2

print(ans)

Submission status: Accepted

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

res = 0
for a, b, c in zip(A, B, C):
    S = {a, b, c}
    res += len(S) - 1
print(res)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
from collections import Counter

N=int(input())
ABC=[input() for i in range(3)]

ANS=0
for i in range(N):
    counter=Counter([ABC[j][i] for j in range(3)])

    ANS+=3-max(counter.values())

print(ANS)

Submission status: Accepted

Solution code:
def main():
  n = int(raw_input().strip())
  a = [raw_input().strip() for i in xrange(3)]
  foo = 0
  for i in xrange(n):
    bucket = { }
    for s in a:
      bucket[s[i]] = True
    foo += len(bucket) - 1
  print(foo)

if __name__ == '__main__':
  main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(str(input()))
B = list(str(input()))
C = list(str(input()))
count = 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]:
        count+=1
    else:
        count+=2
print(count)

Submission status: Accepted

Solution code:
n = int(input())

a = list(input())

b = list(input())

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

Submission status: Accepted

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

ans = 0
for i in range(N):
    d = dict()
    d[a[i]] = d.get(a[i], 0) + 1
    d[b[i]] = d.get(b[i], 0) + 1
    d[c[i]] = d.get(c[i], 0) + 1
    t = max(d[a[i]], d[b[i]], d[c[i]])
    ans += (3 - t)
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 and b == c:
        continue
    if a == b or b == c or a == c:
        ans += 1
        continue
    ans += 2

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()
n=I()
a=S()
b=S()
c=S()
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 -*-

def main():
    """Function."""
    n = int(input())
    a = str(input())
    b = str(input())
    c = str(input())

    counter = 0
    for i in range(n):
        temp = len(set((a[i], b[i], c[i])))

        if temp == 1:
            pass
        elif temp == 2:
            counter += 1
        elif temp == 3:
            counter += 2

    print(counter)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

ans = 0
for i in range(N):
    c = set([A[i], B[i], C[i]])
    if len(c) == 3:
        ans += 2
    elif len(c) == 2:
        ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#n, a, b = map(int, input().split())
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]:
        continue
    if a[i] == b[i] or b[i] == c[i] or c[i] == a[i]:
        ans += 1
        continue
    ans += 2

print(ans)

Submission status: Accepted

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

for i in range(n):
    if a[i] == b[i] and a[i] == c[i]:
        pass
    elif a[i] != b[i] and a[i] != c[i] and b[i] != c[i]:
        count += 2
    else:
        count += 1

print(count)

Submission status: Accepted

Solution code:
n = int(input())
a = input()
b = input()
c = input()
ans = 0
for i,j,k in zip(a,b,c):
  if i == j and j == k:
    continue
  elif i == j or j == k or k == i:
    ans += 1
  else:
    ans += 2
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve(N, A, B, C):
    ans = 0
    for a, b, c in zip(A, B, C):
        if a == b and b == c and a == c:
            pass
        elif a == b or b == c or a == c:
            ans += 1
        else:
            ans += 2
    return ans


if __name__ == "__main__":
    N = int(input())
    A = input()
    B = input()
    C = input()
    print(solve(N, A, B, C))

Submission status: Accepted

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

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

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]: continue
	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:
N = int(input())
A = input()
B = input()
C = input()
ans = 0
for i in range(N):
    s = set()
    s.add(A[i])
    s.add(B[i])
    s.add(C[i])
    if len(s)==1:
        pass
    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 i in range(N):
    if A[i] == B[i]:
        if B[i] != C[i]:
            ans += 1
    else:
        if B[i] == C[i]:
            ans += 1
        else:
            if C[i] == A[i]:
                ans += 1
            else:
                ans += 2
print(str(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = input()
B = input()
C = input()
ans = 0
for i in range(N):
    a = A[i]
    b = B[i]
    c = C[i]

    if a == b == c:
        continue
    elif a == b:
        ans += 1

    elif a == c:
        ans += 1
    elif c == b:
        ans += 1
    else:
        ans += 2

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] and c[i]!=a[i]:
    ans=ans+2
  elif a[i]==b[i] and b[i]==c[i]:
    ans=ans+0
  else:
    ans = ans+1
    
print(ans)

Submission status: Accepted

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

co = 0
for i in range(N):
	if A[i] != B[i] and B[i] != C[i] and C[i] != A[i]:
		co += 2
	elif A[i] == B[i] and B[i] == C[i]:
		pass
	else:
		co += 1

print(co)

Submission status: Accepted

Solution code:
N=int(input())
A=input()
B=input()
C=input()
num=0
for i in range(N):
    a=A[i]
    b=B[i]
    c=C[i]
    if a==b:
        if b==c:
            continue
        elif b!=c:
            num+=1
    elif a!=b:
        if b==c:
            num+=1
        elif a==c:
            num+=1
        else:
            num+=2
print(num)

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()
a = ns()
b = ns()
c = ns()

ans = 0
for ai, bi, ci in zip(a,b,c):
    if ai == bi == ci:
        continue
    
    elif ai == bi or bi == ci or ci == ai:
        ans += 1
    
    else:
        ans += 2
        
print(ans)

Submission status: Accepted

Solution code:
def num_min_ops(a, b, c):
    res = 0
    for triple in zip(a, b, c):
        m = len(set(triple))
        res += m - 1
    return res


def main():
    _ = int(input())
    a = input()
    b = input()
    c = input()
    r = num_min_ops(a, b, c)
    print(r)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

ret=0

for i in range(N):
  a=A[i]
  b=B[i]
  c=C[i]
  
  if a==b==c:
    continue
  elif a!=b and a!=c and b!=c:
    ret+=2
  else:
    ret+=1
print(ret)

Submission status: Accepted

Solution code:
N = int(input())
A,B,C = input(),input(),input()
ans = 0
for a,b,c in zip(A,B,C):
    if a != b and b != c and c != a:
        ans += 2
    elif a == b == c:
        ans += 0
    else:
        ans += 1
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) :
    #print(a,b,c)
    
    if (a == b == c) :
        ans += 0
    elif (a != b) and (b != c) and (c != a) :
        ans += 2
    else :
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a=list(input())
b=list(input())
c=list(input())
res = 0
for i in range(n):
    d = len(list(set([a[i],b[i],c[i]])))
    if d == 3:
        res += 2
    elif d == 2:
        res += 1
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stderr, setrecursionlimit
setrecursionlimit(2147483647)
def getInt():
    return int(input())
def getInts():
    return [int(i) for i in input().split()]
def getIntLines(n=1):
    res = []
    for _ in range(n):
        res.append(getInt())
    return res
def getIntsLines(n=1):
    res = []
    for _ in range(n):
        res.append(getInts())
    return res
def debug(*args, **kwargs):
    print(*args, file=stderr, **kwargs)

n = getInt()
ast = input()
bst = input()
cst = input()

ans = 0

for a, b, c in zip(ast,bst,cst):
    if a == b == c:
        continue
    elif a == b or b == c or c == a:
        ans += 1
    else:
        ans += 2
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = list(input())
b = list(input())
c = list(input())
count = 0
for i in range(n):
    if a[i]!=b[i] and b[i]!=c[i] and c[i]!=a[i]:
        count+=2
    elif a[i]==b[i] and b[i]==c[i]:
        count+=0
    else:
        count+=1
print(count)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

result = 0

for a, b, c in zip(A, B, C):
    if a == b == c:
        pass
    elif a == b or b == c or a == c:
        result += 1
    else:
        result += 2

print(result)

Submission status: Accepted

Solution code:

def main():
    buf = input()
    N = int(buf)
    buf = input()
    A = buf
    buf = input()
    B = buf
    buf = input()
    C = buf
    sub_count = 0
    for i in range(N):
        if A[i] == B[i] and B[i] == C[i] and C[i] == A[i]:
            pass
        elif A[i] == B[i] or B[i] == C[i] or C[i] == A[i]:
            sub_count += 1
        else:
            sub_count += 2
    print(sub_count)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#JMD
#Nagendra Jha-4096

 
import sys
import math

#import fractions
#import numpy
 
###File Operations###
fileoperation=0
if(fileoperation):
    orig_stdout = sys.stdout
    orig_stdin = sys.stdin
    inputfile = open('W:/Competitive Programming/input.txt', 'r')
    outputfile = open('W:/Competitive Programming/output.txt', 'w')
    sys.stdin = inputfile
    sys.stdout = outputfile

###Defines...###
mod=1000000007
 
###FUF's...###
def nospace(l):
    ans=''.join(str(i) for i in l)
    return ans
 
 
 
##### Main ####
t=1
for tt in range(t):
    n=int(input())
    a=[]
    for i in range(3):
        a.append(str(input()))

    ans=0

    for i in range(n):
        l=set()
        l.add(a[0][i])
        l.add(a[1][i])
        l.add(a[2][i])

        ans+=len(l)-1
    print(ans)
    #n,k,s= map(int, sys.stdin.readline().split(' '))
    #a=list(map(int,sys.stdin.readline().split(' ')))
    
    
#####File Operations#####
if(fileoperation):
    sys.stdout = orig_stdout
    sys.stdin = orig_stdin
    inputfile.close()
    outputfile.close()

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):
    n = len(set([a, b, c]))
    ans += (n - 1)

print(ans)

Submission status: Accepted

Solution code:
#      
import collections, atexit, math, sys, bisect 

sys.setrecursionlimit(1000000)
def getIntList():
    return list(map(int, input().split()))    

try :
    #raise ModuleNotFoundError
    import numpy
    def dprint(*args, **kwargs):
        #print(*args, **kwargs, file=sys.stderr)
        # in python 3.4 **kwargs is invalid???
        print(*args,  file=sys.stderr)
    dprint('debug mode')
except Exception:
    def dprint(*args, **kwargs):
        pass



inId = 0
outId = 0
if inId>0:
    dprint('use input', inId)
    try:
        f = open('input'+ str(inId) + '.txt', 'r')
        sys.stdin = f #标准输出重定向至文件
    except Exception:
        dprint('invalid input file')
if outId>0:
    dprint('use output', outId)
    try:
        f = open('stdout'+ str(outId) + '.txt', 'w')
        sys.stdout = f #标准输出重定向至文件
    except Exception:
        dprint('invalid output file')
        
    atexit.register(lambda :sys.stdout.close())     #idle 中不会执行 atexit
    
N, = getIntList()
#print(N)
s0 = input()
s1 = input()
s2 = input()
r = 0
for i in range(N):
    if s0[i] == s1[i] == s2[i]:
        continue
    if s0[i] == s1[i] or s1[i] == s2[i] or s2[i] == s0[i]:
        r+=1
        continue
    r+=2
print(r)

Submission status: Accepted

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

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

Submission status: Accepted

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

def getMN():
    a = input().split()
    b = [int(i) for i in a]
    return b[0],b[1]

def getlist():
    a = input().split()
    b = [int(i) for i in a]
    return b

n = getN()
a = input()
b = input()
c = input()
ans = 0
for s,t,r in zip(a,b,c):
    ans += len(list(set([s,t,r]))) - 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = input()
b = input()
c = input()
ans = 0
for i, j, k in zip(a,b,c):
    if i == j == k:
        pass
    elif i == j or j == k or k == i:
        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):
    S = len(set([a,b,c]))
    if S==3: ans += 2
    elif S==2: ans += 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]==C[i]:
        continue
    elif A[i]!=B[i] and B[i]!=C[i] and C[i] !=A[i]:
        ans +=2
    else:
        ans +=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]:
    pass
  elif A[i] == B[i]:
    ans += 1
  elif B[i] == C[i]:
    ans += 1
  elif C[i] == A[i]:
    ans += 1
  else:
    ans += 2
    
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
A = input()
B = input()
C = input()
cnt = [0 for i in range(len(A))]
for i in range(len(A)):
    if A[i] == B[i] == C[i]:
        cnt[i] = 0
    elif A[i] == B[i]:
        cnt[i] = 1
    elif B[i] == C[i]:
        cnt[i] = 1
    elif C[i] == A[i]:
        cnt[i] = 1
    else:
        cnt[i] = 2

print(sum(cnt))

Submission status: Accepted

Solution code:
def inpl(): return list(map(int, input().split()))


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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    n = input()
    aa = raw_input().strip()
    bb = raw_input().strip()
    cc = raw_input().strip()
    count = 0
    for a, b, c in zip(aa, bb, cc):
        s = {a, b, c}
        if len(s) == 3:
            count += 2
        elif len(s) == 2:
            count += 1
    print count


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

print(count)

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]):
        continue
    if (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:
n = int(input())
a = input()
b = input()
c = input()
ans = 0
for i in range(n):
	if not (a[i] == b[i] and b[i] == c[i] and c[i] == a[i]):
		ans += 2
		if a[i] == b[i] or b[i] == c[i] or c[i] == a[i]:
			ans -= 1
print(ans)

Submission status: Accepted

Solution code:
import collections

N=int(raw_input())
A=[[],[],[]]
for i in range(3):
    A[i]=raw_input()
ans=0
for j in range(N):
    s=[A[x][j] for x in range(3)]
    c = collections.Counter(s)
    ans += (len(c) -1)
print ans

Submission status: Accepted

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

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

print(num_changes)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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]:
        cnt += 1
    elif B[i] ==  C[i]:
        cnt += 1
    elif 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()

ans = 0
for i in range(N):
  a, b, c = A[i], B[i], C[i]
  if a == b == c:
    continue
  if a == b or b == c or c == a:
    ans += 1
  else:
    ans += 2
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python

n = int(input())
A, B, C = input(), input(), input()

cnt = 0
for a, b, c in zip(A, B, C):
    cnt += len(set([a, b, c])) - 1
print(cnt)

Submission status: Accepted

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

print(num)

Submission status: Accepted

Solution code:
n=int(input())
a=input()
b=input()
c=input()
ct=0
for i in range(n):
  if a[i]==b[i] and 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: Accepted

Solution code:
n=int(input())
a=input()
b=input()
c=input()
ans=0
for i in range(n):
  if a[i]==b[i]==c[i]:
    ans+=0
  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:
N = int(input())
A, B, C = input(), input(), input()
ans = 0
for a, b, c in zip(A, B, C):
    L = len(set([a, b, c]))
    if L == 3:
        ans += 2
    elif L == 2:
        ans += 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]:
        continue
    if A[i] == B[i] or B[i] == C[i] or C[i] == A[i]:
        ans += 1
    else:
        ans += 2
print( ans)