#define MOD 1000000007
#pragma GCC target("popcnt")
#include <bits/stdc++.h>
#include <numeric>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int64_t n;
	cin>>n;
	array < int64_t , 86 > fib;
	vector < int64_t > decomp,fin,ans;
	fib[0]=fib[1]=1;
	for(int i=2; i<fib.size(); ++i){
		fib[i]=fib[i-1]+fib[i-2];
	}
	for(int i=fib.size()-1; i>=0; --i){
		while(n>=fib[i]){
			n-=fib[i];
			decomp.push_back(i);
		}
	}
	reverse(decomp.begin(),decomp.end());
	ans.resize(decomp.back()+1);
	for(auto &i:decomp){
		++ans[ans.size()-1-i];
	}
	if(decomp.back()&1){
		for(int i=0; i<ans.size(); ++i){
			while(ans[i]--){
				fin.push_back(1+!(i&1));
			}
			fin.push_back(3+(i&1));
		}
	}
	else{
		for(int i=0; i<ans.size(); ++i){
			while(ans[i]--){
				fin.push_back(1+(i&1));
			}
			fin.push_back(3+!(i&1));
		}
	}
	fin.pop_back();
	cout<<fin.size()<<'\n';;
	for(int i=0; i<fin.size(); ++i){
		cout<<fin[i]<<'\n';
	}
}

#include <bits/stdc++.h>
using namespace std;

int main(){
    long long i,j,k,l,m,n,t,r,g,b1;
    long long a[200010],b[200010],c[200010];
    char ch;
    cin>>n;
    r=g=b1=0;
    for(i=0;i<2*n;i++) {
        cin>>k;
        getchar();
        ch=getchar();
        if (ch=='R') {
            a[r++]=k;
        }
        else if (ch=='G') {
            b[g++]=k;
        }
        else if (ch=='B') {
            c[b1++]=k;
        }
    }

    sort(a,a+r);
    sort(b,b+g);
    sort(c,c+b1);

    if (r%2==0&&g%2==0&&b1%2==0) {
        cout<<0;
    }
    else {
        i=j=0;
        m=1e16;
        while(i<g&&j<b1) {
            if (m>abs(b[i]-c[j])) m=abs(b[i]-c[j]);
            if (b[i]<c[j]) i++;
            else j++;
        }
        i=j=0;
        l=1e16;
        while(i<r&&j<b1) {
            if (l>abs(a[i]-c[j])) l=abs(a[i]-c[j]);
            if (a[i]<c[j]) i++;
            else j++;
        }
        i=j=0;
        k=1e16;
        while(i<r&&j<g) {
            if (k>abs(a[i]-b[j])) k=abs(a[i]-b[j]);
            if (a[i]<b[j]) i++;
            else j++;
        }

        if (r%2==0) {
            if (m>l+k) cout<<l+k;
            else cout<<m;
        }
        else if (g%2==0) {
            if (l>m+k) cout<<m+k;
            else cout<<l;
        }
        else {
            if (k>m+l) cout<<m+l;
            else cout<<k;
        }
    }
    
    return 0;
}