#include<bits/stdc++.h>

using namespace std;

#define int long long
#define fi  first
#define se  second

typedef pair<int,int>   ii;

priority_queue<int> q;
vector<ii>  v;
int n, sum = 0;

signed main()  {
    ios_base::sync_with_stdio(false);   cin.tie(0);
    cin >> n;
    for(int i = 0 ; i < n ; ++i)    {
        int D, L;   cin >> D >> L;
        v.push_back(ii(D + L,L));
    }
    sort(v.begin(),v.end());
    for(int i = 0 ; i < n ; ++i)    {
        q.push(v[i].se);
        sum += v[i].se;
        if(sum > v[i].fi)   {
            sum -= q.top();
            q.pop();
        }
    }

    cout << q.size() << endl;
}

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string a, b, c;
  cin >> a >> b >> c;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    string x, y, z;
    x = a.at(i); y = b.at(i); z = c.at(i);
    set<string> s{x, y, z};
    if (s.size() == 3) {
      ans += 2;
    } else if (s.size() == 2) {
      ans += 1;
    }
  }
  cout << ans << '\n';
  return 0;
}