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: //package competitveprogramming;
  import java.util.*;
  import java.math.*;
  import java.io.*;
  public class Main
  {
      //By shwetank_verma
  	public static void main(String[] args)
      {
          FastReader sc=new FastReader();
          
                  int t=1;
                t=sc.nextInt();
                  while(t-->0){
                  	int n=sc.nextInt();
                  	String a=sc.next();
                  	String b=sc.next();
                  	char ch1[]=a.toCharArray();
                  	char ch2[]=b.toCharArray();
                  	boolean visited[]=new boolean[n];
                  	for(int i=0;i<n;i++) {
                  		if(ch2[i]=='1') {
                  			boolean f=true;
                  			if(ch1[i]=='0') {
                  				visited[i]=true;
                  				f=false;
                  			}
                  			if(i>0&&f) {
                  				if(ch1[i-1]=='1'&&!visited[i-1]) {
                  					visited[i-1]=true;
                  					f=false;
                  				}
                  			}
                  			if(i+1<n&&f) {
                  				if(ch1[i+1]=='1'&&!visited[i]) {
                  					visited[i+1]=true;
                  				}
                  			}
                  		}
                  	}
                  	int ans=0;
                  	for(int i=0;i<n;i++) {
                  		ans+=visited[i]?1:0;
                  	}
                  	System.out.println(ans);
                  }
      }
  
  static void ruffleSort(long[] a) {
  		int n=a.length;
  		Random r=new Random();
  		for (int i=0; i<a.length; i++) {
  			long oi=r.nextInt(n), temp=a[i];
  			a[i]=a[(int)oi];
  			a[(int)oi]=temp;
  		}
  		Arrays.sort(a);
  	}
  static void ruffleSort(int[] a) {
  		int n=a.length;
  		Random r=new Random();
  		for (int i=0; i<a.length; i++) {
  			int oi=r.nextInt(n), temp=a[i];
  			a[i]=a[oi];
  			a[oi]=temp;
  		}
  		Arrays.sort(a);
  }
  static class DSU
  {
  
      int[] id;
      
      int[] sz;
      int c;
      public DSU(int N)
      {
          id = new int[N];
          sz = new int[N];
          for(int i = 0; i < N; i++)
          {
              id[i] = i;
              sz[i]=1;
          }
          
      }
  
      private int root(int i)
      {
  
          while(i!=id[i])
          {
              id[i]=id[id[i]];
              i=id[i];
          }
          return i;
      }
  
      public boolean connected(int p, int q)
      {
          return (root(p)==root(q));
      }
  
      public void union(int p, int q)
      {
          int i= root(p);
          int j=root(q);
  
          if(i==j)return;
  
          if(sz[i] < sz[j])
          {
              id[i]=j;
              sz[j]+=sz[i];
          }
          
          else
          {
              id[j]=i;
              sz[i]+=sz[j];
          }
      }
  
  }
  static long fact[];
  static long mod_pow(long a , long n , long mod){
      if(n == 0){
          return 1;
      }
      long res = mod_pow((a*a)%mod , n/2 , mod);
      if(n % 2!=0){
          res = (res*a)%mod;
      }
      return res;
  }
  static long mod_inv(long x , long mod){
      return mod_pow(x , mod - 2 , mod);
  }
  static long nCr(int n , int r , long mod){
      return ((fact[n]*mod_inv(fact[r] , mod) % mod)* (mod_inv(fact[n - r] , mod) % mod))%mod;
  }
  static void factorial(int n,long mod){
  	fact=new long[n+1];
      fact[0] = 1;
      for(int i = 1; i < n; i++){
          fact[i] = (i*fact[i - 1]);
          fact[i] %= mod;
      }
  }
  static boolean visited[][];
  static int dx[]= {-1,0,1,0};
  static int dy[]= {0,1,0,-1};
  static boolean isValid(char ch[][],int x,int y,int n,int m) {
  	if(x<0||x>=n||y<0||y>=m) {
  		return false;
  	}
  	if(ch[x][y]=='#'||visited[x][y]) {
  		return false;
  	}
  	return true;
  	
  }
  static void dfs(char ch[][],int x,int y,int n,int m) {
  	visited[x][y]=true;
  	for(int i=0;i<4;i++) {
  		if(isValid(ch,x+dx[i],y+dy[i],n,m))
  		dfs(ch,x+dx[i],y+dy[i],n,m);
  	}
  }
  static class Point implements Comparable<Point>
  {
      int x, y;
      Point(int x, int y)
      {
          this.x = x;
          this.y = y;
      }
      
      public int compareTo(Point P)
      {
          return this.x - P.x;
      }
  }
  static void leftrotate(int arr[],int n,int d) {
  	reverse(arr,0,d-1);
  	reverse(arr,d,n-1);
  	reverse(arr,0,n-1);
  }
  static void reverse(int arr[],int low,int high) {
  	while(low<high) {
  		int temp=arr[low];
  		arr[low]=arr[high];
  		arr[high]=temp;
  		low++;
  		high--;
  	}
  }
      static class FastReader
      {
          BufferedReader br;
          StringTokenizer st;
    
          public FastReader()
          {
              br = new BufferedReader(new
                       InputStreamReader(System.in));
          }
    
          String next()
          {
              while (st == null || !st.hasMoreElements())
              {
                  try
                  {
                      st = new StringTokenizer(br.readLine());
                  }
                  catch (IOException  e)
                  {
                      e.printStackTrace();
                  }
              }
              return st.nextToken();
          }
    
          int nextInt()
          {
              return Integer.parseInt(next());
          }
    
          long nextLong()
          {
              return Long.parseLong(next());
          }
    
          double nextDouble()
          {
              return Double.parseDouble(next());
          }
    
          String nextLine()
          {
              String str = "";
              try
              {
                  str = br.readLine();
              }
              catch (IOException e)
              {
                  e.printStackTrace();
              }
              return str;
          }
      }
      static int mod=1000000007;
      static boolean primes[]=new boolean[100002];
      static ArrayList<Integer> b=new ArrayList<>();
      static boolean seive(int n){
          Arrays.fill(primes,true);
          primes[0]=primes[1]=false;
          for(int i=2;i*i<=n;i++){
              if(primes[i]==true){
                  for(int p=i*i;p<=n;p+=i){
                      primes[p]=false;
                  }
              }
          }
          if(n<1000007){
          	for(int i=2;i<=n;i++) {
          		if(primes[i])
          			b.add(i);
          	}
              return primes[n];
          }
          return false;
          
      }
      static int gcd(int a,int b){
          if(b==0)
          return a;
          return gcd(b,a%b);
      }
      static long GCD(long a,long b){
          if(b==0)
          return a;
          return GCD(b,a%b);
      }
      static ArrayList<Integer> segseive(int l,int r){
      	
      	ArrayList<Integer> isprime=new ArrayList<Integer>();
      	boolean p[]=new boolean[r-l+1];
      	Arrays.fill(p, true);
          
      	for(int i=0;b.get(i)*b.get(i)<=r;i++) {
      		int currprime=b.get(i);
      		int base=(l/currprime)*currprime;
      		if(base<l) {
      			base+=currprime;
      		}
      		for(int j=base;j<=r;j+=currprime) {
      			p[j-l]=false;
      		}
      		
      		
      		if(base==currprime) {
      			p[base-l]=true;
      		}
      		
      	}
      	for(int i=0;i<=r-l;i++) {
      		if(p[i])
      			isprime.add(i+l);
      	}
      	return isprime;
      }
        static int LowerBound(int a[], int x) { // x is the target value or key
    int l=-1,r=a.length;
    while(l+1<r) {
      int m=(l+r)>>>1;
      if(a[m]>=x) r=m;
      else l=m;
    }
    return r;
  }
  static int UpperBound(int a[], int x) {// x is the key or target value
      int l=-1,r=a.length;
      while(l+1<r) {
         int m=(l+r)>>>1;
         if(a[m]<=x) l=m;
         else r=m;
      }
      return l+1;
   }
  
    
       
  }
  