#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int main(){
  int N;
  cin>>N;
  while(cin>>N && N){
    string s;
    cin>>s;
    int dp[3] = {};
    dp[0] = 0; dp[1] = INF; dp[2] = INF;
    for(int i = 0; i < N + 1; i++){
      int nextdp[3] = {};
      fill(nextdp, nextdp + 3, INF);
      bool need[2] = {};
      if(i != 0) need[0] |= s[2 * i - 1] == 'Y';
      if(i != 0) need[1] |= s[2 * i - 1 + 2 * N] == 'Y';
      if(i != N) need[0] |= s[2 * i] == 'Y';
      if(i != N) need[1] |= s[2 * i + 2 * N] == 'Y';
      REP(j, 3)REP(k, 3){
        int x = -1;
        if(j == 0){
          if(need[1]) x = 3 + abs(2 * k - 3);
          else if(need[0]) x = 1 + abs(2 * k - 1);
          else x = abs(2 * k - 0);
        }else if(j == 1){
          if(need[0] && need[1]) x = 4;
          if(need[0] && !need[1]) x = 1 + abs(2 * k - 1);
          if(!need[0] && need[1]) x = 1 + abs(2 * k - 3);
          if(!need[0] && !need[1]) x = abs(2 * k - 2);
        }else {
          if(need[0]) x = 3 + abs(2 * k - 1);
          else if(need[1]) x = 1 + abs(2 * k - 3);
          else x = abs(2 * k - 4);
        }
        nextdp[k] = min(nextdp[k], dp[j] + x + 2);
      }
      memcpy(dp, nextdp, sizeof(dp));
      /*
      printf("%d: need[0] = %d need[1] = %d ", i, need[0], need[1]);
      debug(dp, dp + 3);
      */
    }
    cout<<dp[0] / 2 - 1<<endl;
  }
  return 0;
}