#include <iostream>
#include <vector>
#include<math.h>
#include<algorithm>
#include <float.h>
#include <iomanip>
#include<string>
using namespace std;




int main()
{

	unsigned long long N, a, c,bmax,bmin,I,Iking,a_,b_,c_;
	N = 0;
	cin >> N;

	Iking = 100000000000000;
	bmax = floor(log2(N));
	bmin = 0;
	if (N == 1) { cout << 1; return 0; }

	for (int b = bmin; b < bmax; b++) {
		a = floor(N /pow(2, b));
		c = N - a * (unsigned long long)pow(2, b);
		I = a + b + c;
		if (I < Iking) { Iking = I; a_ = a; b_ = b; c_ = c; }
	}

	cout << Iking;
	
}
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = 1; i <= (int)(n); i++)
#define drep(i, n) for(int i = (n)-1; i >= 0; i--)
#define ALL(x) (x).begin(), (x).end()
#define dup(x,y) (((x)+(y)-1)/(y))
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

// Mod int
const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
  ll x;
  mint():x(0){}
  mint(ll x):x((x%mod+mod)%mod){}
  // mint(ll x):x(x){}
  mint& fix() { x = (x%mod+mod)%mod; return *this;}
  mint operator-() const { return mint(0) - *this;}
  mint& operator+=(const mint& a){ if((x+=a.x)>=mod) x-=mod; return *this;}
  mint& operator-=(const mint& a){ if((x+=mod-a.x)>=mod) x-=mod; return *this;}
  mint& operator*=(const mint& a){ (x*=a.x)%=mod; return *this;}
  mint operator+(const mint& a)const{ return mint(*this) += a;}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  bool operator<(const mint& a)const{ return x < a.x;}
  bool operator==(const mint& a)const{ return x == a.x;}
};
istream& operator>>(istream&i,mint&a){i>>a.x;return i;}
ostream& operator<<(ostream&o,const mint&a){o<<a.x;return o;}
//



int main() {
  vi a(5);
  rep(i, 4) cin >> a[i];
  a[4] = 0;
  bool ok = false;
  int wa = 0;
  rep(i, 4) wa += a[i];
  rep(i, 5) rep(j, 5) rep(k, 5){
    if (i==j||j==k||k==i) continue;
    int x = a[i] + a[j] + a[k];
    int y = wa - x;
    if (x == y) ok = true;
  }
  if (ok) cout<< "Yes\n";
  else cout << "No\n";
}