
#include "bits/stdc++.h"
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,cc,n) for(int i=cc;i<(n);++i)
#define dreps(i,cc,n) for(int i=cc;i>(n);--i)
#define llreps(i,cc,n) for(long long i=cc;i<(n);++i)
#define ALL(v) begin(v),end(v)
#define rALL(v) rbegin(v),rend(v)
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;

int main()
{
	string s;
	cin >> s;
	stack<char> st;
	rep(i, s.length())
	{
		char ch = s[i];
		if (ch == '6')
			ch = '9';
		else if (ch == '9')
			ch = '6';
		st.push(ch);
	}
	string ans = "";
	while(!st.empty())
	{
		ans += st.top();
		st.pop();
	}
	cout << ans << endl;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n;
	cin>>n;
	string s;
	cin>>s;
	string st;
	for(int i=0;i<n;i++)
	{
		st.pb(s[i]);
		int l = sz(st);
		if(l >= 3)
		{
			if(st.substr(l-3,3) == "fox")
			{
				st.pop_back();
				st.pop_back();
				st.pop_back();
			}
		}
	}
	cout<<sz(st)<<"\n";
	return 0;
}