#include <bits/stdc++.h>

using namespace std;

int main() {
    int sum = 0;
    int mini = 101;
    for (int i = 0; i < 4; ++i) {
        int s;
        cin >> s;
        sum += s;
        mini = min(s, mini);
    }
    int s1, s2;
    cin >> s1 >> s2;
    cout << sum - mini + max(s1, s2) << '\n';
}

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n) ;i++)

using namespace std;
using p=pair<int,int>;
typedef long long ll;

int main() {
  int n;
  cin >> n;
  vector<int>a(n);
  rep(i,n){
    cin >> a[i];
  }
  int k=1000000;
  int ans=0;
  rep(i,n){
    k=min(k,a[i]);
    if(k==a[i]){
      ans++;
    }
  }
  cout << ans << endl;

  return 0;

}
