Rudolf is on his way to the castle. Before getting into the castle, the security staff asked him a question:

Given two binary numbers $a$ and $b$ of length $n$. How many different ways of swapping two digits in $a$ (only in $a$, not $b$) so that bitwise OR of these two numbers will be changed? In other words, let $c$ be the bitwise OR of $a$ and $b$, you need to find the number of ways of swapping two bits in $a$ so that bitwise OR will not be equal to $c$.

Note that binary numbers can contain leading zeros so that length of each number is exactly $n$.

Bitwise OR is a binary operation. A result is a binary number which contains a one in each digit if there is a one in at least one of the two numbers. For example, $01010_2$ OR $10011_2$ = $11011_2$.

Well, to your surprise, you are not Rudolf, and you don't need to help him$\ldots$ You are the security staff! Please find the number of ways of swapping two bits in $a$ so that bitwise OR will be changed.


-----Input-----

The first line contains one integer $n$ ($2\leq n\leq 10^5$) — the number of bits in each number.

The second line contains a binary number $a$ of length $n$.

The third line contains a binary number $b$ of length $n$.


-----Output-----

Print the number of ways to swap two bits in $a$ so that bitwise OR will be changed.


-----Examples-----
Input
5
01011
11001

Output
4

Input
6
011000
010011

Output
6



-----Note-----

In the first sample, you can swap bits that have indexes $(1, 4)$, $(2, 3)$, $(3, 4)$, and $(3, 5)$.

In the second example, you can swap bits that have indexes $(1, 2)$, $(1, 3)$, $(2, 4)$, $(3, 4)$, $(3, 5)$, and $(3, 6)$.

Difficulty: competition

Starter code:

Solutions:
n = int(input())
a = [int(x) for x in input().strip()]
b = [int(x) for x in input().strip()]
p, q, r, s = 0, 0, 0, 0
for i in range(n):
    if a[i] * 2 + b[i] == 0:
        p += 1
    if a[i] * 2 + b[i] == 1:
        q += 1
    if a[i] * 2 + b[i] == 2:
        r += 1
    if a[i] * 2 + b[i] == 3:
        s += 1
print(p*r + p*s + q*r)


n = int(input())
a = input()
b = input()

ao = a.count('1')
az = n - ao

u, v = 0, 0

for i in range(n):
    if b[i] == '0':
        if a[i] == '1':
            u += 1
        else:
            v += 1

print(u * az + v * ao - u * v)


n = int(input())
a = input()
b = input()
zo = {(0, 0): 0, (0, 1): 0, (1, 0): 0, (1, 1): 0}
for c, d in zip(a, b):
    zo[int(c), int(d)] += 1

print(zo[0, 0] * (zo[1, 0] + zo[1, 1]) + zo[1, 0] * zo[0, 1])


n = int(input())
a = input()
b = input()
cnt0, cnt1 = 0, 0
for i in range(n):
    if a[i] == '0':
        cnt0 += 1
    else:
        cnt1 += 1
ans = 0
t0, t1 = 0, 0
for i in range(n):
    if b[i] == '0':
        if a[i] == '0':
            ans += cnt1
            t0 += 1
        else:
            ans += cnt0
            t1 += 1
print(ans-t0*t1)

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

n = ii()
a = list(map(int, list(input().strip())))
b = list(map(int, list(input().strip())))

o = [0, 0]
z = [0, 0]
for i in range(n):
    if a[i]:
        o[b[i]] += 1
    else:
        z[b[i]] += 1

ans = z[0] * o[1] + z[1] * o[0] + z[0] * o[0]

print(ans)


n=int(input())
r=input()
r1=input()
ans1=0
ans0=0
c1=0
c0=0
for i in range(n):
	if (r1[i]=="0"):
		if (r[i]=="0"):
			c0=c0+1
		else:
			c1=c1+1
	else:
		if (r[i]=="0"):
			ans0=ans0+1
		else:
			ans1=ans1+1
fans=c0*ans1+c1*ans0+(c0*c1)
print (fans)

n = int(input())
a = [*map(int, list(input()))]
b = [*map(int, list(input()))]
one = sum(a)
zero = len(a) - one
ans = 0
wk1 = 0
wk2 = 0
for i in range(n):
    if b[i] == 0:
        if a[i] == 0:
            ans += one
            wk1 += 1
        else:
            ans += zero
            wk2 += 1
print(ans - wk1 * wk2)

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()

a_1 = []
for i in range(n):
    if b[i] == "1":
        a_1.append(a[i])

num0 = a.count("0")
num1 = a.count("1")
num0_1 = a_1.count("0")
num1_1 = a_1.count("1")

print(num0 * num1 - num0_1 * num1_1)

n=int(input())
a,b=[*map(int,list(input()))],[*map(int,list(input()))]
changed=[False]*n

for i in range(n):
    if b[i]==0: changed[i]=True

stateCnt=[0]*4
for i in range(n):
    if a[i]==1 and changed[i]==True:
        stateCnt[0]+=1
    elif a[i]==1 and changed[i]==False:
        stateCnt[1]+=1
    elif a[i]==0 and changed[i]==True:
        stateCnt[2]+=1
    else:
        stateCnt[3]+=1

print(stateCnt[0]*stateCnt[2]+stateCnt[0]*stateCnt[3]+stateCnt[2]*stateCnt[1])

n = int(input())
a = list(input())
b = list(input())

other_0 = other_1 = imp_0 = imp_1 = 0

for i in range(n):
  if b[i] ==  '1':
    if a[i] == '0':
      other_0 += 1
    else:
      other_1 += 1
  else:
    if a[i] == '0':
      imp_0 += 1
    else:
      imp_1 += 1

print((imp_0 * other_1) + (imp_1 * other_0) + (imp_0 * imp_1))


n=int(input())
s1=str(input())
s2=str(input())
ans1=0
ans2=0
ans3=0
ans4=0
for i in range(n):
    if(s2[i]=='0' and s1[i]=='1'):
        ans1+=1
    elif(s2[i]=='0' and s1[i]=='0'):
        ans2+=1
    if(s1[i]=='1'):
        ans3+=1
    if(s1[i]=='0'):
        ans4+=1
ansx=0
ansy=0
for i in range(n):
    if(s2[i]=='0' and s1[i]=='0'):
        ansx+=(ans3-ans1)
        ansy+=ans1
    elif(s2[i]=='0' and s1[i]=='1'):
        ansx+=(ans4-ans2)
        ansy+=ans2
ans=ansx
ans+=(ansy)//2
print(ans)

3

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

    d = {(0, 0): 0, (0, 1): 0, (1, 0): 0, (1, 1): 0}
    c = 0
    for i in range(N):
        a = int(A[i])
        b = int(B[i])

        c += d[(a, b)]

        if (a, b) == (0, 0):
            d[(1, 0)] += 1
            d[(1, 1)] += 1
        elif (a, b) == (0, 1):
            d[(1, 0)] += 1
        elif (a, b) == (1, 0):
            d[(0, 0)] += 1
            d[(0, 1)] += 1
        else:
            d[(0, 0)] += 1

    print(c)


def __starting_point():
    main()

__starting_point()

a=0
b=0
c=0
d=0
n=int(input())
s=input()
t=input()
for i in range(n):
    if s[i]=='0' and t[i]=='0':
        a+=1
    elif s[i]=='0' and t[i]=='1':
        b+=1
    elif s[i]=='1' and t[i]=='0':
        c+=1
    elif s[i]=='1' and t[i]=='1':
        d+=1
print(a*(c+d)+b*c)

n = int(input())
a = input()
b = input()

if len(set(a)) == 1:
    print(0)
else:
    ed = 0
    zer = 0
    for i in a:
        if i == '0':
            zer += 1
        else:
            ed += 1
            
    sed = szer = 0
    for i in range(n):
        if b[i] == '0':
            if a[i] == '0':
                szer += 1
            else:
                sed += 1
    print(sed * zer + szer * ed - szer * sed)

n = int(input())
a = input()
b = input()
x = 0
y = 0
z = 0
for i in range(n):
	if(b[i] == '0'):
		if(a[i] == '1'):
			x+=1
		else:
			y+=1
	else:
		if(a[i] == '1'):
			z+=1
print(y * z + x * a.count('0'))


a,b,c,d=0,0,0,0
n=int(input())
s1,s2=input(),input()

for i in range(n):
    a+=s1[i]=='0' and s2[i]=='1'
    b+=s1[i]=='0' and s2[i]=='0'
    c+=s1[i]=='1' and s2[i]=='1'
    d+=s1[i]=='1' and s2[i]=='0'

print(a*d+b*c+b*d)


n=int(input())
a=input()
b=input()
x,y,z,w=0,0,0,0
""" w 00
    x 01
    y 10
    z 11 """
for i in range(n):
    if a[i]=='0':
        if b[i]=='0':
            w+=1
        else:
            x+=1
    else:
        if b[i]=='0':
            y+=1
        else:
            z+=1
print(w*(y+z) + y*x)

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import time


n       = int(input())
a       = input()
b       = input()

start   = time.time()

p00     = 0
p11     = 0
p10     = 0
p01     = 0

for i in range(n):
    if a[i] == '0':
        if b[i] == '0':
            p00 += 1
        else:
            p01 += 1
    else:
        if b[i] == '0':
            p10 += 1
        else:
            p11 += 1

ans = p00*p11+p10*p01+p00*p10
print(ans)
finish = time.time()
#print(finish - start)


n = int(input())
a = list(map(int, list(input())))
b = list(map(int, list(input())))
a0 = 0
a1 = 0
ans = 0
b0 = 0
b1 = 0
for i in a:
    if i == 0:
        a0 += 1
    else:
        a1 += 1
for i in range(n):
    if b[i] == 0:
        if a[i] == 0:
            ans += a1
            b0 += 1
        else:
            ans += a0
            b1 += 1
ans -= b0 * b1
print(ans)


n=int(input())
a=input()
b=input()
zer=0
one=0
ta=a.count('1')
tz=a.count('0')
for i in range(n):
    if a[i]=='0' and b[i]=='0':
        zer+=1
    elif a[i]=='1' and b[i]=='0':
        one+=1
ans=zer*ta+one*tz-zer*one
print(ans)

n = int(input())
s1 = input()
s2 = input()
smth = dict()
smth['01'] = 0
smth['00'] = 0
smth['10'] = 0
smth['11'] = 0
ans = 0
for i in range(n):
    smth[s1[i] + s2[i]] += 1
for i in range(n):
    if s1[i] == '0':
        if s2[i] == '0':
            ans += smth['10']
            ans += smth['11']
        else:
            ans += smth['10']
print(ans)

n = int(input())
x = input()
y = input()
xl = [int(i) for i in x]
yl = [int(i) for i in y]
c1 = 0
c2 = 0
cnt1 = xl.count(1)
cnt0 = xl.count(0)
#print(cnt1)
for i in range(n):
    if(x[i]=='0' and y[i]=='0'):
        c1+=1
    elif(x[i]=='1' and y[i]=='0'):
        c2+=1
cnt1-=c2
#print(c1,c2)
print(c1*cnt1+c2*cnt0)

#list_int 並べて出力 print (' '.join(map(str,ans_li)))
#list_str 並べて出力 print (' '.join(list))

from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
AtoZ = [chr(i) for i in range(65,65+26)]
atoz = [chr(i) for i in range(97,97+26)]

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

N = int(input())
aa = list(map(int,list(input())))
bb = list(map(int,list(input())))
x00 = x01 = x10 = x11 = 0

for i in range(N):
	if aa[i] and bb[i]:
		x11 += 1
	elif not aa[i] and bb[i]:
		x01 += 1
	elif aa[i] and not bb[i]:
		x10 += 1
	else:
		x00 += 1

print(x00*(x10+x11)+x10*x01)


USE_STDIO = False

if not USE_STDIO:
    try: import mypc
    except: pass

def main():
    n, = list(map(int, input().split(' ')))
    a = [x for x in map(int, input())]
    b = [x for x in map(int, input())]
    cnts = [0, 0, 0, 0]
    for x, y in zip(a, b):
        cnts[x*2+y] += 1
    ans = cnts[0] * cnts[3] + cnts[1] * cnts[2] + (cnts[0] * cnts[2])
    print(ans)


def __starting_point():
    main()




__starting_point()

from sys import stdin
from math import *

line = stdin.readline().rstrip().split()
n = int(line[0])


numbers = stdin.readline().rstrip().split()[0]
numbers2 = stdin.readline().rstrip().split()[0]

cant00 = 0
cant01 = 0
cant11 = 0
cant10 = 0
for i in range(len(numbers)):
    if numbers[i] == '0' and numbers2[i] == '0':
        cant00+=1
    if numbers[i] == '1' and numbers2[i] == '0':
        cant01+=1
    if numbers[i] == '0' and numbers2[i] == '1':
        cant10+=1
    if numbers[i] == '1' and numbers2[i] == '1':
        cant11+=1
print(cant00*cant01 + cant00 * cant11 + cant01 * cant10)