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


#define int long long int
typedef pair<int, int> pii;
#define f(i,a,b) for(int i=a;i<b;i++)
#define fo(i,a,b) for(int i = a; i<=b;i+=1)
// #define Vector vector
#define rf(i,a,b)  for(int i=a;i>=b;i--)
#define vll vector<int>
#define sz(a) int(a.size())
#define all(v) v.begin(), v.end()
#define pb push_back
#define pf push_front 
#define MAXN 100010
#define MOD 1000000007
#define mod 998244353
#define deb(x) cout << '>' << #x << ':' << x << endl;
#define debug(x) cout << '>' << #x << ':' << x << " ";
#define nl '\n'
#define MS(x,y) fill_n(*x, sizeof x / sizeof **x, y);
#define mem(x,y) memset(x,y,sizeof(x));
#define INF 1000000000000000000
#define IO                 \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);

void solve(){
    int n;
    cin >> n;
    string s;
    cin >> s;

    stack<char> stk;
    
    char prev = '*', prevprev = '*';

    for(int i = 0; i < n; i++){
        if(stk.empty()){
            stk.push(s[i]);
        }
        else {
            if(s[i] == 'x' and stk.size() >= 2){
                prev = stk.top();
                stk.pop();
                prevprev = stk.top();
                stk.pop();
                if(prev == 'o' and prevprev == 'f'){

                }
                else {
                    stk.push(prevprev);
                    stk.push(prev);
                    stk.push(s[i]);
                }
            }
            else {
                stk.push(s[i]);
            }
        }
    }
    cout << stk.size() << nl;
    return ;
}
main()
{
    IO;
    int T = 1;
    // cin >> T;
    for(int c=1; c <= T; c++){
        solve();
        // cout<<"Case #"<<c<<": ";
    }
    return 0;
}
#include <bits/stdc++.h>

#define ll long long
#define map unordered_map
#define set unordered_set
#define l_l pair<ll, ll>
#define P pair<ll, ll>
#define vll vector<ll>
#define mll map<ll, ll>
#define mp make_pair
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define rev(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define revs(i, n) for (int i = ((int)(n)); i > 0; --i)
// template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
// template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using namespace std;

const ll MOD = 1000000007LL;
const ll INF = (1LL << 60LL);

// template <class T> void plus_mod(T &a, const T &b) {a = (a + b) % MOD;}

int main() {
  // std::cout << std::fixed << std::setprecision(10);

  ll r1, c1;
  scanf("%lld %lld", &r1, &c1);

  ll r2, c2;
  scanf("%lld %lld", &r2, &c2);

  ll dist = abs(r2 - r1) + abs(c2 - c1);

  if (dist <= 0) {
    cout << (0) << endl;
    return 0;
  }

  if (dist <= 3) {
    cout << (1) << endl;
    return 0;
  }

  ll sr = abs(r2 - r1);
  ll sc = abs(c2 - c1);
  if (abs(sr - sc) == 0) {
    // 1ワープ
    cout << (1) << endl;
    return 0;
  } else if (abs(sr - sc) <= 3) {
    // 1ワープ+徒歩
    cout << (2) << endl;
    return 0;
  } else {
    if (dist % 2 == 0) {
      // 2ワープ
      cout << (2) << endl;
      return 0;
    } else {
      // 2ワープ+徒歩
      if (dist <= 6) {
        cout << (2) << endl;
        return 0;
      }
      cout << (3) << endl;
      return 0;
    }
  }
}
