description: There is a chessboard of size n by n. The square in the i-th row from top and j-th column from the left is labelled (i,j).
  
  Currently, Gregor has some pawns in the n-th row. There are also enemy pawns in the 1-st row. On one turn, Gregor moves one of his pawns. A pawn can move one square up (from (i,j) to (i-1,j)) if there is no pawn in the destination square. Additionally, a pawn can move one square diagonally up (from (i,j) to either (i-1,j-1) or (i-1,j+1)) if and only if there is an enemy pawn in that square. The enemy pawn is also removed.
  
  Gregor wants to know what is the maximum number of his pawns that can reach row 1?
  
  Note that only Gregor takes turns in this game, and the enemy pawns never move. Also, when Gregor's pawn reaches row 1, it is stuck and cannot make any further moves.
  
  Input
  
  The first line of the input contains one integer t (1≤ t≤ 2⋅ 10^4) — the number of test cases. Then t test cases follow.
  
  Each test case consists of three lines. The first line contains a single integer n (2≤ n≤ 2⋅{10}^{5}) — the size of the chessboard.
  
  The second line consists of a string of binary digits of length n, where a 1 in the i-th position corresponds to an enemy pawn in the i-th cell from the left, and 0 corresponds to an empty cell.
  
  The third line consists of a string of binary digits of length n, where a 1 in the i-th position corresponds to a Gregor's pawn in the i-th cell from the left, and 0 corresponds to an empty cell.
  
  It is guaranteed that the sum of n across all test cases is less than 2⋅{10}^{5}.
  
  Output
  
  For each test case, print one integer: the maximum number of Gregor's pawns which can reach the 1-st row.
  
  Example
  
  Input
  
  
  4
  3
  000
  111
  4
  1111
  1111
  3
  010
  010
  5
  11001
  00000
  
  
  Output
  
  
  3
  4
  0
  0
  
  Note
  
  In the first example, Gregor can simply advance all 3 of his pawns forward. Thus, the answer is 3.
  
  In the second example, Gregor can guarantee that all 4 of his pawns reach the enemy row, by following the colored paths as demonstrated in the diagram below. Remember, only Gregor takes turns in this "game"!
  
  <image>
  
  In the third example, Gregor's only pawn is stuck behind the enemy pawn, and cannot reach the end.
  
  In the fourth example, Gregor has no pawns, so the answer is clearly 0.
solution: import sys
  import math
  import heapq
  import bisect
  from collections import Counter
  from collections import defaultdict
  from io import BytesIO, IOBase
  import string
  
  
  class FastIO(IOBase):
      newlines = 0
  
      def __init__(self, file):
          import os
          self.os = os
          self._fd = file.fileno()
          self.buffer = BytesIO()
          self.writable = "x" in file.mode or "r" not in file.mode
          self.write = self.buffer.write if self.writable else None
          self.BUFSIZE = 8192
  
      def read(self):
          while True:
              b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, self.BUFSIZE))
              if not b:
                  break
              ptr = self.buffer.tell()
              self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
          self.newlines = 0
          return self.buffer.read()
  
      def readline(self):
          while self.newlines == 0:
              b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, self.BUFSIZE))
              self.newlines = b.count(b"\n") + (not b)
              ptr = self.buffer.tell()
              self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
          self.newlines -= 1
          return self.buffer.readline()
  
      def flush(self):
          if self.writable:
              self.os.write(self._fd, self.buffer.getvalue())
              self.buffer.truncate(0), self.buffer.seek(0)
  
  
  class IOWrapper(IOBase):
      def __init__(self, file):
          self.buffer = FastIO(file)
          self.flush = self.buffer.flush
          self.writable = self.buffer.writable
          self.write = lambda s: self.buffer.write(s.encode("ascii"))
          self.read = lambda: self.buffer.read().decode("ascii")
          self.readline = lambda: self.buffer.readline().decode("ascii")
  
  
  sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
  input = lambda: sys.stdin.readline().rstrip("\r\n")
  
  
  def get_int():
      return int(input())
  
  
  def get_ints():
      return list(map(int, input().split(' ')))
  
  
  def get_int_grid(n):
      return [get_ints() for _ in range(n)]
  
  
  def get_str():
      return input().strip()
  
  
  def get_strs():
      return get_str().split(' ')
  
  
  def flat_list(arr):
      return [item for subarr in arr for item in subarr]
  
  
  def yes_no(b):
      if b:
          return "YES"
      else:
          return "NO"
  
  
  def binary_search(good, left, right, delta=1, right_true=False):
      """
      Performs binary search
      ----------
      Parameters
      ----------
      :param good: Function used to perform the binary search
      :param left: Starting value of left limit
      :param right: Starting value of the right limit
      :param delta: Margin of error, defaults value of 1 for integer binary search
      :param right_true: Boolean, for whether the right limit is the true invariant
      :return: Returns the most extremal value interval [left, right] which is good function evaluates to True,
              alternatively returns False if no such value found
      """
  
      limits = [left, right]
      while limits[1] - limits[0] > delta:
          if delta == 1:
              mid = sum(limits) // 2
          else:
              mid = sum(limits) / 2
          if good(mid):
              limits[int(right_true)] = mid
          else:
              limits[int(~right_true)] = mid
      if good(limits[int(right_true)]):
          return limits[int(right_true)]
      else:
          return False
  
  
  def prefix_sums(a):
      p = [0]
      for x in a:
          p.append(p[-1] + x)
      return p
  
  
  def solve_a():
      p = get_int()
      if p == 5:
          return 2, 4
      else:
          return 2, (p - 1) // 2
  
  
  def solve_b():
      n = get_int()
      enemy = list(get_str())
      me = list(get_str())
      cnt = 0
  
      for i in range(n):
          if me[i] == '1' and enemy[i] == '0':
              cnt += 1
          elif i > 0 and me[i] == '1' and enemy[i - 1] == '1':
              enemy[i - 1] = 'x'
              cnt += 1
          elif i < n - 1 and me[i] == '1' and enemy[i + 1] == '1':
              enemy[i + 1] = 'x'
              cnt += 1
      return cnt
  
  
  
  t = get_int()
  for _ in range(t):
      print(solve_b())
  