#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cmath>
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int m=(int)(sqrt(n*2));
  if(m*(m+1)==n*2)cout<<"YES";else cout<<"NO";
  return 0;
}

#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int m=2*n;
    for(int i=1;i<=sqrt(m);i++)
	{
        if(i*(i+1)==m)
        {
             printf("YES");
             return 0;
        }
    }
    printf("NO");
    return 0;
}

#include<iostream>
using namespace std;
int n;
bool cym=1;
int main()
{
	cin.sync_with_stdio(false);
	cin>>n;
	for(int i=1;i<=35;i++)
		if((i*(i+1)/2)==n)
			{
				cym=0;
				break;
			}
	if(cym==0)
		cout<<"YES";
	else
		cout<<"NO";
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	scanf("%d",&n);
	n*=2;
	bool bo=0;
	for(int i=1;i<=sqrt(n);i++)
	{
		if(i*(i+1)==n)
		{
			printf("YES");
			bo=100;
			break;
		}
	}
	if(!bo)
		printf("NO");
}

#include<cstdio>
int main(){
	int n;
	scanf("%d",&n);
	int i;
	for(i=1;i*(i+1)/2<=n;i++){
		if(i*(i+1)/2==n){
			printf("YES");
			return 0;
		}
	}
	printf("NO");
	return 0;
}

#include <iostream>
#include <cmath>
using namespace std;

int main(){

    double x;
    int n;
    cin >> x;
    n = sqrt(2*x);
    if (n*(n+1)==2*x) cout << "YES"; else cout << "NO";

return 0;}

#include <iostream>;
using namespace std;

int main()
{
    int n=0;
    cin>>n;
    int cnt=1;
    while(n>0)
    {
        n-=cnt;
        cnt++;
    }
    if(n!=0)
    {
        cout<<"NO"<<endl;
    }
    else
    {
        cout<<"YES"<<endl;
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long n,r=0;
    cin>>n;
    for(int i=1;i<=999;++i)
    {
        r+=i;
        if(r==n)
        {
            cout<<"YES"<<endl;
            return 0;
        }
        if(r>n)
        {
            cout<<"NO"<<endl;
            return 0;
        }
  }
  return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <map>
#include <cmath>
#include <queue>
#include <iomanip>
#include <bitset>
#include <unordered_map>
#include <stack>
#include <memory.h>
#include <list>
#include <numeric>
#include <functional>
#include <complex>
#include <cassert>
#include <regex>

#define ll long long
#define ld long double
#define ull unsigned ll
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pii pair<int,int>
#define pll pair<ll>
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pii>
#define vvi vector<vector<int>>
#define vvll vector<vector<ll>>
#define forn(it,from,to) for(int (it)=from; (it)<to; (it)++)

using namespace std;

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);

	int n;
	cin >> n;
	int t = 1;
	while (t <= n)
	{
		if ((t * (t + 1) / 2) == n)
		{
			cout << "YES";
			return 0;
		}
		t++;
	}
	cout << "NO";
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    float x = sqrt(1+8*n);
    if((int)floor(x) == (int)ceil(x))
     cout << "YES";
    else cout << "NO";
    return 0;
}

#include<iostream>
using namespace std;
int main()
{
    int n,i=0,ok=0;
    cin>>n;
    int doublen=n*2;
    for(i=1;i<=n;++i)
        if(i*(i+1)==doublen)
        {
            ok=1;
            break;
        }
    ok?cout<<"YES":cout<<"NO";
    return 0;
}

#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int n;
int main()
{
    cin>>n;
    int i;
    for(i=1;i<=n;i++){
    	if(i*(i+1)==2*n){
    		cout<<"YES";
    		return 0;
    	}
    }
    cout<<"NO";
    return 0;
}

#include <iostream>
using namespace std;

int main()
{
    int n;
    cin >> n;
    for(int i = 1; i <= 100001; i++)
    {
        if(i * (i + 1) / 2 == n)
        {
            cout << "YES\n";
            return 0;
        }
    }
    cout << "NO\n";
    return 0;
}

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

int main()
{
    int n;
    cin>>n;
    for(int j=1; j<=n; j++)
    {
       // cout<<(j*(j+1))/2<<endl;
        if(((j*(j+1))/2)==n)
        {
            cout<<"YES\n";
            return 0;
        }
    }
    cout<<"NO\n"<<endl;
}

//  ♥LOVE♥          ♥LOVE♥
//  ♥LOVE♥♥LOVE♥  ♥LOVE♥♥LOVE♥
//♥LOVE♥♥LOVE♥♥LOVE♥♥LOVE♥♥LOVE♥
//   ♥LOVE♥♥LOVE♥♥LOVE♥♥LOVE♥
//      ♥LOVE♥♥LOVE♥♥LOVE♥
//         ♥LOVE♥♥LOVE♥
//           ♥LOVE♥
//              ♥

#include<bits/stdc++.h>
typedef long long ll;
using namespace std;

int main()
{
    ll n;
	cin >>n;
	 for(ll i=1;i<=n;i++)
        if((i*(i+1))/2==n){
            cout<<"YES";
            return 0;
        }

        cout<<"NO";

    }

#include <iostream>

using namespace std;

int main(){
	int n , i = 1 ,  tri = 0;
	cin >> n ;
	while(tri < n){
		tri= (i * (i+1)) / 2;
		i ++ ;
	}
	if ( tri == n)
		cout << "YES" ;
	else
		cout << "NO" ;
	return 0;
}

#include<iostream>
#include<cmath>

using namespace std;

int main(){
	int a,i=1;
	cin>>a;
	while(i*(i+1)/2 < a){
		i++;
	}
	if(i*(i+1)/2==a) cout<<"YES";
	else cout<<"NO";
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int n,b[5051],sum;
int main(){
    scanf("%d",&n);
    for(int i=1;i<=100;i++)
    {
    sum+=i;
    b[sum]=1;
    }
    if(b[n])
    cout<<"YES";
    else cout<<"NO";
    return 0;
}

#include <bits/stdc++.h>

#define sf scanf
#define pf printf
#define MAX 10010

using namespace std;

int ar[1000];

int main()
{

    int sum = 0;
    for(int i = 1 ; ; ++i)
    {
        sum = sum + i;
        if(sum >= 1000) break;
        ar[sum] = 1;
    }
    int t , num ;
    sf("%d" , &num);
    if(ar[num]) pf("YES\n");
    else pf("NO\n");

    return 0;
}

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

int main()
{
    long long n,i,q ;
    cin >> n ;
    n = n*2 ;
    q = sqrt(n) ;
    for ( i = 0 ; i <= q ; i++ )
    { if ( i*(i+1) == n ) { cout << "YES" ; return 0 ; } }
    cout << "NO" ;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,i,ans,x,d;
    cin>>n;
    x=(8*n)+1;
    d=sqrt(x);
    double f=sqrt((double)x);
    if(f-d==0.0){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }
    return 0;
}

#include <iostream>
#include <cmath>
using namespace std;
int main() {
	int n, m, i;
	cin >> n;
	m = 2 * n;
	for(int i = 0; i < sqrt(m); i++) {
		if(i * (i + 1) == m) {
			cout << "YES" << endl;
			return 0;
		}
	}
	cout << "NO" << endl;
	return 0;
}

#define maxn 50
#include<iostream>
using namespace std;
int f[maxn];

int main()
{
    f[0]=0;
    for (int i=1;i<=40;++i)
        f[i]=f[i-1]+i;

    int n;
    cin >> n;
    for (int i=1;i<=40;++i)
        if (f[i]==n)
        {
            cout << "YES";
            return 0;
        }
    cout << "NO";

    return 0;
}

#include<iostream>
using namespace std;
int main()
{
    int n,flag=0;
    cin>>n;
    for(int i=0;i<=n;i++)
    {
        if((i*(i+1)/2)==n)
        {
            cout<<"YES";
            flag=1;
            break;
        }

    }
    if(flag==0)
    {
        cout<<"NO";
    }
}

/*
    Md Babul Hasan (Noyen)
    Patuakhali Science and Technology University
    Faculty of Computer Science and Engineering
    16 th Batch (PSTU-CSE-2019)
    bhyean@gmail.com // B H Yean Hasan
*/

#include<bits/stdc++.h>
#define ll long long int
#define pi acos(-1)
#define vc vector<ll>
#define in(a) scanf("%d",&a)
#define srt(a) sort(a.begin(),a.end())
#define fr(i,n) for(ll i=0;i<n;i++)

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(0);

    ll a,b,c,d,n,t,count=0,sum=0,result,i,j,k;
    bool is;
    string s;

    cin>>n;

    for(i=1;;i++)
    {
        n=n-i;

        if(n==0){
            cout<<"YES"<<endl;
            break;
        }
        else if(n<0)
        {
            cout<<"NO"<<endl;
            break;
        }

    }

    return 0;
}

#include<bits/stdc++.h>
using namespace std ;
typedef long long int ll;

int main()
{

    ll t=1;
    //cin>>t;
    while(t>0)
    {
        t--;
        ll n,k=0,max=LONG_MIN,min=LONG_MAX,flag=0,cnte=0,cnto=0,ans=0,gcd=1;
        cin>>n;

        for(ll i=1;i<=n;i++)
            {
                if(n==((i+1)*i)/2){cout<<"YES\n";flag=1;break;}
            }
        if(flag==0)cout<<"NO\n";

    }
}

#include<iostream>
#include<algorithm>
using namespace std;
int main () {
int x, j = 1;
cin >> x;
while(x){
	x -= j; j++;
	if(x < 0) {
		cout << "NO"; return 0;
	}
}
cout << "YES";
}

#include <iostream>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <map>
#include <sstream>
#include <queue>
#include <stack>
#include <set>
#include <string>
#include <string.h>
using namespace std;
#define PI 3.141592653
#define MOD 1000000007
#define all(x) x.begin(),x.end()
#define set(a,b) memset(a,b,sizeof(a))
#define mp(a,b) make_pair(a,b)
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;
int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= 500; i++) {
        if ((i*(i + 1)) / 2 == n) {
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
    return 0;
}

#include<iostream>
using namespace std;
int main(){
	int n,i;
	cin>>n;
	for(i=1;i<=31;i++){
		if((i*i+i)/2==n){
			cout<<"YES";
			return 0;
		}
	}
	cout<<"NO";
	return 0;
}

#include<iostream>
using namespace std;
int n, i;
int main()
{
	cin >> n;
	for(i = 1; i <= n; i ++)
	{
		if(i * (i + 1) / 2 == n) {
			cout << "YES" << endl;
			return 0;
		}
	}
	cout << "NO" << endl;
	return 0;
}

#include <iostream>
#include <vector>
#include <fstream>
#include <algorithm>
#include <stdlib.h>
#include <time.h>
using namespace std;
int main(){
	int n,k,t,c,d,e,m=0,o,x,f,j,a,pn,xelfasi;
	string name,gvari;
	cin>>t;
	for(int i=1;i<t+1;i++){
		n=i;
		n=n*(n+1)/2;
		if(t==n){
			cout<<"YES";
			break;
		}
		else m++;
	}
	if(m==t){
		cout<<"NO";
	}
}

#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int m=2*n,i;
    for(i=1;i<=sqrt(m);i++)
    {
        if(i*(i+1)==m)
        {
             printf("YES");
             return 0;
        }
    }
    printf("NO");
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int n;
int main()
{
	scanf("%d",&n);
	for(int i=1; i<=n; i++)
	 if( i*(i+1)==n*2 ) {
			printf("YES");
		 return 0;
		}
   printf("NO");
	return 0;
}

#include<iostream>
#include<string>
#define fr(i,n) for(int i=0 ; i<n ; i++)
using namespace std;
int main()
{
	int x,c=1,sum=0;
	cin >> x;
	while (true)
	{
		sum += c;
		if (sum == x)
		{
			cout << "YES";
			break;
		}
		if (sum > x)
		{
			cout << "NO";
			break;
		}
		c++;
	}

}

#include <iostream>
#include <string>
using namespace std;
int main() {
	int Tn;
	string flag="NO";
	cin >> Tn;
	for (int i = 1; i <= Tn; i++) {
		if (i*(i + 1) / 2 == Tn) {
			flag = "YES";
			break;
		}
	}
	cout << flag << endl;
	return 0;
}

#include<iostream>
#include<cmath>
using namespace std;
int n;
int main()
{
    cin>>n;
    n*=2;
    int k=sqrt(n);
    if(k*k==n)
    {
        cout<<"NO"<<endl;
        return 0;
    }
    if(k*(k+1)==n)
    {
        cout<<"YES"<<endl;
        return 0;
    }
    cout<<"NO"<<endl;
    return 0;
}

#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<stdlib.h>
int main()
{
	int n;
	scanf("%d", &n);
	int value=0;
	if(n==1)
	{
		printf("YES");
		_Exit(0);
	}
	for(int i=1;i<n;i++)
	{
		int temp=(pow(i,2)+i)/2;
		if(n==temp)
		{

			printf("YES");
			value=1;
			break;
		}
	}
	if(value==0)
	{
		printf("NO");
	}
	return 0;
}

#include<iostream>
#include<algorithm>
using namespace std;
long long n,a;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		if(i*(i+1)/2==n) {cout<<"YES\n";return 0;}
	}
	cout<<"NO\n";
	return 0;
}

#include <iostream>
#include <cmath>
using namespace std;

int main()
{
    int t;
    cin >> t;

    int g = sqrt(8*t+1);
    double f = sqrt(8*t+1);
    g--;
    f--;

    if (g%2 == 0 && f == g)
    cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll x;
    cin>>x;
    if(ceil(sqrt(1+8*x))==sqrt(1+8*x))
    {
        cout<<"YES";
    }
    else
    {
        cout<<"NO";
    }
    return 0;
}

#include <bits/stdc++.h>
#include <bitset>
#define ll long long
using namespace std;
//const int B = 15 , N = 1e6+6 , MAX = 2e5+5  , OO = 1000000009;
//ll gcd(ll a, ll b) { return !b ? a : gcd(b , a % b); }
//ll lcm(ll x, ll y) { return (x * y / gcd(x, y)); }
//ll fact(ll z)      { return (z <= 1) ? 1 : z * fact(z - 1); }
//len any int num > 0 ... len = ceil(log10(a+1));
int mohamed , levels = 1;
int main(){
    cin >> mohamed;
   while(1){
        mohamed = mohamed - levels;
        levels++;
        if(mohamed == 0){
            cout << "YES";
            break;
        }
        if(mohamed < 0){
            cout << "NO";
            break;
        }
   }
	return 0;
    }

#include<iostream>
using namespace std;
bool triangular(int n){
    int sum = 0;
    for(int i=1;sum<=n;i++){
        sum = i*(i+1)/2;
        if(sum==n){
            return true;
            break;
        }
    }
    return false;
}
int main(){
    int n=0;
    while(cin>>n){
        if(triangular(n)){
            cout<<"YES"<<endl;
        }else{
            cout<<"NO"<<endl;
        }
    }
    return 0;
}

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cstring>
using namespace std;
int n;
int main()
{
	cin>>n;
	for(int i=1;i*(i+1)/2<=n;i++)
	{
		if(i*(i+1)/2==n)
		{
			cout<<"YES"<<endl;
			return 0;
		}
	}
	cout<<"NO"<<endl;
	return 0;
}

#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <cstdio>
#include <set>

using namespace std;

int main() {
    int n;
    cin >> n;
    int num = sqrt(n * 2);
    if (n * 2 == num * (num + 1))
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}

#include<stdio.h>
int main()
{
    int n,i;
    scanf("%d",&n);
    for (i=1; i<=n; i++)
    {
        if (i*(i+1)/2==n)
        {
            printf("YES");
            return 0;
        }
    }
    printf("NO");
    return 0;
}

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

int main() {
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */
    int n,i,c=0;
    cin>>n;
    for(i=1;i<=500;++i)
    if((i*(i+1))/2==n)
    c=1;
    if(c==1)
    cout<<"YES";
    else
    cout<<"NO";

    return 0;
}

#include <math.h>
#include <stdio.h>

using namespace std;

int main() {
	int n;
	scanf("%d", &n);
	n <<= 1;
	((int) sqrt(n) * ((int) sqrt(n) + 1) == n) ? puts("YES") : puts("NO");
	return 0;
}

#include<iostream>
using namespace std;
int main()
{
	int i,n;
	cin>>n;
	for(i=1;i<=n;++i)
	if((i*(i+1))/2==n)
	break;

	if(i==n+1)
	cout<<"NO";
	else
	cout<<"YES";
}

#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
    int n,flag=0;
    scanf("%d",&n);
    for(int i=1; i<33; i++)
    {
        if(n==i*(i+1)/2)
        {
            flag=1;
        }
    }
    if(flag)
        puts("YES");
    else
        puts("NO");
    return 0;
}
/*2017-08-08 19:03:52.129*/

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
    int n,t,a[2000]={0};
    for(int i=1;i<=40;i++)
    {
        t=i*(i+1)/2;
        a[t]=1;
    }
    scanf("%d",&n);
    if(a[n])
        puts("YES");
    else
        puts("NO");
    return 0;
}/*2017-08-08 19:10:26.192*/

#include <iostream>
#include <string>
using namespace std;
int main()
{
	int a,b=0;
	cin>>a;
	for(int i=1;i<=a;i++)
	{
		if((i*(i+1))/2==a)
		{
			b++;
			break;
		}
	}
	if(b==0)
		cout<<"NO";
	else
		cout<<"YES";
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 1000000007;
int main()
{
    int a;
    cin >> a;
    ll p = 8 * a;
    p += 1;
    p = sqrt(p);
    p -= 1;
    p = p/2;
    ll mm = (p * (p + 1))/2;
    if(a == mm)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
    return 0;
}

#include <iostream>

using namespace std;

int main()
{
    int N;
    cin >> N;
    if(N == 1)
    {
        cout << "YES" << endl;
    }
    else
    {
        int Count = 0;
        int flag = 1;

        int i = 1;
        while(1)
        {
            if(Count == N)
            {
                flag = 1;
                break;
            }
            if(Count > N)
            {
                flag = 0;
                break;
            }
            Count += i;
            i++;
        }
        if(flag == 1)
        {
            cout << "YES" << endl;
        }
        else
        {
            cout << "NO" << endl;
        }
    }
    return 0;
}

#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int num[6300000];
int main()
{
	int i,j,k;
	memset(num,0,sizeof(num));
	for(i=1;i<=500;i++)
	num[(i*(i+1))/2]=1;
	while(~scanf("%d",&k))
	{
		if(num[k]==1)
		printf("YES\n");
		else
		printf("NO\n");
	}
	return 0;
}/*2017-08-08 19:10:30.884*/

#include<iostream>
using namespace std;

int main(){
        int n;
        cin >> n;
        for(int i = 0; i < 999; i++){
                if(i * (i + 1) / 2 == n){
                        cout << "YES" <<endl;
                        return 0;
                }
        }
        cout << "NO" <<endl;

        return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
	long long n,m,i;
	cin>>n;
	for(i=1;i<=999;i++){
		m+=i;
		if(m==n){
			cout<<"YES"<<endl;
			return 0;
		}
		if(m>n){
			cout<<"NO"<<endl;
			return 0;
		}
	}
	return 0;
}

#include<iostream>
using namespace std;
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=500;i++){
		if(i*(i+1)/2==n){
			cout<<"YES";
			return 0;
		}
	}
	cout<<"NO";
}

#include <iostream>

using namespace std;

int main()
{
    float n,t,z;
        cin>>t;
    for(n=1;n<t+1;n++)
    {
        z=n*(n+1)/2;
        if(z==t)
        {
            cout <<"YES";
            break;
        }

    }
    if(n==t+1)
    cout<<"NO";
        return 0;
}

#include<bits/stdc++.h>
using namespace std;
int n;
int main()
{
	cin>>n;
	for(int i=1;;i++)
	{
		if(i*(i+1)/2==n)
		{
			cout<<"YES"<<endl;
			return 0;
		}
		if(i*(i+1)/2>n)
		{
			cout<<"NO"<<endl;
			return 0;
		}
	}
	return 0;
}

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

vector <int> v;

void prealoc()
{
    int count = 1;
    for(int i = 0; i<501; i++) v.push_back(0);
    for(int i = 1; i<501; i++)
    {
        v.insert(v.begin()+i, 1);
        i += count;
        ++count;
    }
}

int main()
{
    prealoc();
    int n;
    while(cin >> n)
    {
        if(v[n]) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

#pragma GCC optimize "-Ofast"
#include<bits/stdc++.h>

using namespace std;

#define int long long
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define reg(x) x.begin(),x.end()
#define FOR(i, a, b) for(int i =a;i < b; i++)
#define REP(i, b) FOR(i, 0, b)
#define print(x) cerr << #x << " is " << x << endl;
#define print_it(v) for(auto x: v) cout<<x<<" ";cout<<endl;
#define print_arr(a, n) REP(i, n) cout<<a[i]<<" "; cout<<endl;
#define Init ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0),cout << fixed << setprecision(12)
#define vi vector<int>
#define pii pair<int, int>

const int mod = 1e9 + 7;
const int MX = 2e5 + 3;
const int Maxh = 20;

int fib[MX];

char a[1000][1000];

int32_t main()
{
	Init;
	int n ; cin>>n;
	set<int> s;
	REP(i, 700)
	{
		int temp = i*(i+1);
		temp/=2;
		s.insert(temp);
	}
	if(s.find(n) == s.end())
	{
		cout<<"NO";
	}
	else cout<<"YES";
}

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int n,sum,i,flag;
    while(scanf("%d",&n)==1)
    {
        sum=flag=0;
        for(i=1;;i++)
        {
            sum=sum+i;
            if(sum==n)
            {
                flag=1;
                break;
            }
            else if(sum>n)
                break;
        }
        if(flag==1)
            printf("YES\n");
        else
            printf("NO\n");
    }
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define PI                   acos(-1)
#define inf                  1e9
#define SZ(a)                a.size()
#define ms(a,b)              memset(a,b,sizeof a)
#define clr(a)               memset(a,0,sizeof a)
#define INPUT                freopen("in.txt","r",stdin)
#define OUTPUT               freopen("out.txt","w",stdout)
#define fast                 ios_base::sync_with_stdio(0); cin.tie(0)
#define LL                   long long
#define isValid(a,b,A,B)     ((0<=a&&a<A) && (0<=b&&b<B))
#define ABS(a,b)             a>b ? a-b : b-a // if a>b is true return a-b eles b-a
#define pb                   push_back
#define mp                   make_pair
#define spc                  printf(" ")
#define nl                   printf("\n")
#define sf                   scanf
#define pf                   printf

/*.......................................................*/

int main()
{
    int n;
    while(cin>>n){
        int N=2*n;
        int sq=sqrt(N);
        if(sq*(sq+1)==N) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
	return 0;
}

#include <iostream>
#include <vector>
#define pb push_back
using namespace std;
int n,m,a[510],idx;
int main(){
    cin>>n;
    for(int i=1;i<=500;i++){
        a[i]=a[i-1]+i;
        if(a[i]==n){
            cout<<"YES"<<endl;
return 0;
}
    }
    cout<<"NO"<<endl;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
    for(int i=1;i<1.2e8;i++)i+=1e-9;
	int s=0,i=1,n;
	scanf("%d",&n);
	while(s<n)s+=i++;
	printf("%s\n",(s==n)?"YES":"NO");
	return 0;
}

#include <iostream>
using namespace std;
int main()
{
    int x ;

    cin>>x;
    for(int i=0;i<=x;i++)
    {
        if((i*(i+1)/2)==x)
           {

            cout<<"YES";
            return 0;
           }

    }
            cout<<"NO";

}

#include <bits/stdc++.h>
using namespace std;
 int main()
 {

     int a=1;int ans=0;int n;
     cin>>n;
     for(int i=1;i<=500;a++,i++){

        ans=ans+a;
        if(ans==n){ cout<<"YES"<<endl;return 0;}
        if(ans >n){cout<<"NO"<<endl;return 0;}
     }

     return 0;
 }

#include<stdio.h>//TRZ like XZN
int main()
{
	int n,i;
	scanf("%d",&n);
	n*=2;
	for(i=1;;i++)
	{
		if(i*(i+1)==n)
		{
			printf("YES");
			return 0;
		}
		if(i*(i+1)>n)
		{
			printf("NO");
			return 0;
		}
	}
}

// C++ program to check if a number is a triangular number
// using simple approach.
#include <iostream>
using namespace std;

// Returns true if 'num' is triangular, else false
bool isTriangular(int num)
{
	// Base case
	if (num < 0)
		return false;

	// A Triangular number must be sum of first n
	// natural numbers
	int sum = 0;
	for (int n=1; sum<=num; n++)
	{
		sum = sum + n;
		if (sum==num)
			return true;
	}

	return false;
}

// Driver code
int main()
{
	int n;
	cin>>n;
	if (isTriangular(n))
		cout << "YES";
	else
		cout << "NO";

	return 0;
}

#include <iostream>
using namespace std;
int n;
int main()
{
    cin >> n;
	n *= 2;
	for (int i = 0; i <= 200; i++)
		{
			if (i * (i + 1) == n)
				{
					cout << "YES\n";
					return 0;
				}
						}
	cout << "NO\n";
    return 0;
}

#include <cstdio>
#include <iostream>
#include <algorithm>
#define FOR(i, a, b) for(int i = a; i <= b; i++)
using namespace std;
int main ()
{
    int n, res[32];
    cin >> n;
    FOR(i, 1, 31) res[i] = i*(i + 1)/2;
    FOR(i, 1, 31)
        if (n == res[i]) {
            cout << "YES";
            exit(0);
        }
    cout << "NO";
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
	long long n;
	cin>>n;
	for(int i=1;i*(i+1)/2<=n;i++){
		if(i*(i+1)/2==n){
			cout<<"YES";
			return 0;
		}
	}
	cout<<"NO";
	return 0;
}

#include<iostream>
#include<cstdio>
#include<limits.h>
using namespace std;
int main()
{
	double n;
	cin >> n;
	for(int i = 1; i <= 100000; i++) {
		if(i * (i + 1) / 2 == n) {
			cout << "YES";
			return 0;
		}
	}
		cout << "NO" <<endl;
		return 0;
}

#include<bits/stdc++.h>
using namespace std;
int n,i,ss=0;
int main()
{
	cin>>n;
	for(i=-3;i<=520;i++)
	{
		if((i*i+i)/2==n){
			ss=1;
			break;
		}
	}
	if(ss)cout<<"YES";
	else cout<<"NO";
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int n,F[505];
main(){
    cin>>n;
    for(int i=1;i<=501;i++){
        F[i]=(i+1)*i/2;
    }
    int id=lower_bound(F+1,F+502,n)-F;
    F[id]==n    ?   cout<<"YES" :   cout<<"NO";
}

#include<iostream>
using namespace std;
int main()
{
  long long n,r=0;
  cin>>n;
  for(int i=1;i<=999;++i)
  {
      r+=i;
      if(r==n)
      {
          cout<<"YES";
          return 0;
      }
      if(r>n)
      {
          cout<<"NO";
          return 0;
      }
  }
  return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b=0;
    scanf("%d",&a);
    for(int i=0;b<a;i++){
		b+=i;
    }
    if(b==a){
		printf("YES");
    }else printf("NO");
    return 0;
}

#include <iostream>

using namespace std;

int main()
{int p,a=0,n,i=1;
cin >>n;
while((a<n)&&(n!=a))
{
    a+=i;

      i++;

}
     if (n==a)
    cout <<"YES";
    else cout <<"NO";
return 0;

}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    map < int, int > m;
    int n;
    cin >> n;
    for(int i = 1; i < 40; i++) {
        int a = (i * (i + 1)) / 2;
        m[a] = 1;
    }
    if(m[n]) {
        cout << "YES";
    }
    else {
        cout << "NO";
    }
    return 0;
}

#include <iostream>
using namespace std;

int main(){
	int n,s;
	cin>>n;
	bool b;
	for(int i=1;i<=35;i++){
		s=(i*(i+1))/2;
		if (s==n){b=true;break;} else b=false;}
		if(n==1)b=true;
	if(b)cout<<"YES" ;else cout<<"NO";

	return 0;
	}

#pragma GCC optimize(3)
#pragma G++ optimize(3)
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
int n;
int main()
{
	cin.tie(0);cout.tie(0);
    ios::sync_with_stdio(false);
    cin>>n;
    for(int i=1;i<=500;i++)
    {
    	if((i*(i+1)/2)==n)
    	{
    		cout<<"YES";exit(0);
		}
	}
	cout<<"NO";
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define fill(a,val) memset(a,val,sizeof(a))
#define f first
#define s second
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
int cal(string str)
{
    int sum=0;
    for(int i=0;i<str.size();i++)
        sum+=(str[i]-'0');
    return sum;
}
int main()
{
   //  freopen("input.txt", "r", stdin);
   // freopen("output.txt", "w", stdout);
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        if((i*(i+1))/2==n)
        {
            cout<<"YES"<<endl;
            return 0;
        }
    }
    cout<<"NO"<<endl;
    return 0;

}

# include <bits/stdc++.h>
# define rr register
int n;
int main(void){
	scanf("%d",&n);
	n<<=1;
	for(rr int i=1;i<=n;++i){
		if(i*i+i==n){
			puts("YES");
			return 0;
		}
	}
	puts("NO");
	return 0;
}

#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll n;
    cin>>n;

    for(int i=1;i<=n;i++)
    {
       if(i*(i+1)/2==n)
       {
           cout<<"YES"<<endl;
           return 0;
       }

    }
    cout<<"NO"<<endl;

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL)
int main()
{
    fastio;
    lli n , c = 0;
    cin >> n;
    for(int i = 1; i < 50; i ++)
    {
        if((i * (i + 1) / 2) == n)
       { cout<<"YES";
        c++;
        break;
       }
     //   break;
       // break;
    }
   if( c != 1)
   cout<< "NO";
}

#include <cstdio>

int main()
{
    int n;
    scanf("%d", &n);
    int l = 0, r = (n >> 1) + 1;
    while (l < r)
    {
        int mid = (l + r) >> 1;
        if (mid * (mid + 1) < (n << 1))
            l = mid + 1;
        else
            r = mid;
    }
    if (l * (l + 1) == (n << 1))
        puts("YES");
    else
        puts("NO");
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,i,j,n;
    cin>>n;
    n*=2;
    for (i=1;i<=sqrt(n);i++)
    {
        a=i*(i+1);
        if (a==n)
        {
            cout<<"YES";
            return 0;
        }
    }
    cout<<"NO";
    return 0;
}

#include<stdio.h>//TRZ_2007 like SYH
int main()
{
	int n,i;
	scanf("%d",&n);
	n*=2;
	for(i=1;;i++)
	{
		if(i*(i+1)==n)
		{
			printf("YES");
			return 0;
		}
		if(i*(i+1)>n)
		{
			printf("NO");
			return 0;
		}
	}
}

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		if(i*(i+1)/2==n){
			cout<<"YES";
			return 0;
		}
	}
	cout<<"NO";
	return 0;
}

#include<cstdio>
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		if(i*(i+1)/2==n){
			printf("YES\n");
			return 0;
		}
	}
	printf("NO\n");
	return 0;
}

#include<iostream>
using namespace std;
int n;
bool cym=1;
int main()
{
	cin>>n;
	for(int i=1;i<=35;i++)
		if((i*(i+1)/2)==n)
			{
				cym=0;
				break;
			}
	if(cym==0)
		cout<<"YES";
	else
		cout<<"NO";
}

#include<bits\stdc++.h>
//#include<boost\lexical_cast.hpp>

#define vec_itr_str_b std::vector<std::string>::iterator itrb
#define vec_itr_str_e std::vector<std::string>::iterator itre
#define vec_itr_int_b std::vector<int>::iterator itrb
#define vec_itr_int_e std::vector<int>::iterator itre
#define FOR(i, n) for(int i = 0; i < (n); ++i)
#define mp make_pair
#define pb .push_back
#define all(n) (n).begin(),(n).end()
#define bit(k,i) (((i)>>k)&1)
#define AZ(a) ((char)(a)>='A' && (char)(a)<='Z')
#define NumofDigits(n)  ((int)log10(n)+1)
#define endl '\n'
#define ends ' '
#define newline std::cout << endl
#define ll long long int
#define MODM 1000000007
#define MAXM 2147483647
#define MAXML 9223372036854775807LL
#define Pi 3.14159265358979323846264338327950288419716939937510582
#define EPS 1e-10
#define SORT(x) std::sort(x.begin(),x.end())
#define REV(x) std::reverse(x.begin(),x.end())
#define fast  std::ios_base::sync_with_stdio(false), std::cin.tie(NULL) , std::cout.tie(NULL)
#define scanarr(n,arr) for (int i = 0; i < n; i++) {int x;std::cin >> x; arr[i] = x;}
#define printarr(n,arr) for (int i = 0; i < n; i++) { std::cout << arr[i]; } newline
#define allstr(str) &str[0],&str[(str.length()-1)]

typedef std::vector<int> vi;
typedef std::vector<std::string> vs;
typedef std::vector<vi> vvi;
typedef std::vector<bool> vb;
typedef std::vector<vb> vvb;
typedef std::pair<int, int> pii;
typedef std::vector<pii> vpii;

#define N 100005

int main()
{
	int  n;
	std::cin >> n;
	double a = (sqrt(n*8 + 1) - 1) / 2;
	if ((a - (int)a) != 0)
		std::cout << "NO" << endl;
	else
		std::cout << "YES" << endl;

}

#include<bits/stdc++.h>
 using namespace std;
 int main()
 {
    /*freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);*/
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    if(n==2)
    {
       cout << "NO";
       return 0;
    }
    int q=(n*(n+1))/2;
    for(int i=1;i<=q;i++)
    {
        if((i*(i+1))/2==q)
        {
            cout << "YES";
            return 0;
        }
    }
    cout << "NO";
    return 0;
 }
 //s[i].size()
 //a=tolower(a) делает char переменную a маленькой,
//a=toupper(a), делает char переменную a большой
/*

 /*  %с – одиночный символ
     %d – десятичное целое число со знаком
     %f – число с плавающей точкой (десятичное представление)
     %s – строка символов (для строковых переменных)
     %u – десятичное целое без знака
     %% - печать знака процента
     printf(“Ваш возраст = %d, Ваш вес = %f”, age, weigth);
     */

/* if((j<n-abs(i-n/2)) and j>=abs(i-n/2))
          {
             cout << "D";
          }
          else
          {
             cout << "*";
          }*/

#include<stdio.h>
#include<string.h>
main()
{
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
int a;
scanf("%d",&a);
if(a%2==0)
{
    printf("NO");
}
else
{
    printf("YES");
}
}

#include"bits/stdc++.h"
using namespace std;
const int N =5e5 + 5;
int n ;

int main() {

scanf("%d",&n);

if(n==1){
    printf("YES");
    return 0;
}

for(int i =2 ; i<500; ++i ){
    if((2*n)%i==0  && (2*n)%(i+1)==0){
        printf("YES");
        return 0;
    }
}

printf("NO\n");
}

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    if(n%2==0){
    	cout<<"NO";
	}else{
		cout<<"YES";
	}
    return 0;
}

#include<stdio.h>
int main()

{
    int n;
    scanf("%d",&n);
    if(n%2==0)
    {
        printf("no\n");
    }
    else
    {
        printf("Yes\n");
    }
    return 0;
}

#include<iostream>
using namespace std;
#include<algorithm>
#include<math.h>
int main ()
{
  int n ;
  cin>>n;
  if(n%3==0||n%3==1)
  cout<<"Yes";
  else cout<<"No";

}

#include<stdio.h>
#include<math.h>

bool triangle[1500];

void buildtri(void);

int main(){

	int i,j,n;
	buildtri();

	while(scanf("%d",&n)==1){
		if(triangle[n]==1) printf("YES\n");
		else printf("NO\n");
	}

	return 0;
}

void buildtri(){

	int i,num;
	for(i=1;i<=30;i++){
		num=i*(i+1);
		num/=2;
		triangle[num]=1;
		if(num>600) break;
	}

}

#include<iostream>
using namespace std;
int main(){
	int n, y;
	cin >> n;
	for (int i = 0;i<=n; i++){

		y = i*(i + 1) / 2;

		if (n == y){
			cout << "Yes";
			break;
		}

	}if (n != y){
		cout << "No";

	}

	cin.get();
	cin.get();
	return 0;
}

#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <set>
#include <fstream>
#include <stack>
#include <algorithm>
#include <ctime>
#include <map>
using namespace std;

int main() {

    //freopen("sale.in", "r", stdin);

    int n; cin >> n;

    int cur = 1;
    int sum = 1;

    for (;sum <= n; ) {
        cur ++;
        sum += cur;
        if (sum == n) {
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;

    return 0;
}

#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=sqrt(n);i++){
		if(i*(i+1)==n){
			cout<<"NO";
			return 0;
		}
	}
	cout<<"YES";
    return 0;
}

#include<iostream>
using namespace std;
int main()
{
    int a[1000],sum=0;
    int n;
    int ok;
    cin>>n;
    for(int i=0;i<=500;i++) {
    a[i]=sum+i;
    sum=a[i];
    }
    for(int i=0;i<=500;i++) {
    if(a[i]==n) {ok=1;break;}
    else ok=0;
    }
    if(ok==1) cout<<"YEs";
    else cout<<"No";
}

#include<stdio.h>//TRZ like SYH
int main()
{
	int n,i;
	scanf("%d",&n);
	n*=2;
	for(i=1;i<25;i++)
	{
		if(i*(i+1)==n)
		{
			printf("YES");
			return 0;
		}
	}
	printf("NO");
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	n*=2;
	for(int i=0;i<=250000;i++){
		if(i*(i+1)/2==n){
			cout<<"YES";
			return 0;
		}
	}
	cout<<"NO";
	return 0;
}

#include <iostream>
using namespace std;

int main()
{
  int n,m,i,j,x=0,y,max=0,z=999,count=0;
  string a[51];
  cin>>n>>m;
  for (i=0;i<n;i++){
    cin>>a[i];
  }
  for (i=0;i<n;i++){
    for (j=0;j<m;j++){
      if (a[i][j]=='*' && x==0){
	if (z>j)
	  z=j;
	x++;
	y=j;
      }
      if (a[i][j]=='*' && x==1){
	if (j-y+1>max)
	  max=j-y+1;
      }
    }
  }
  for (i=0;i<n;i++){
    for (j=z;count<max;count++){
      cout<<a[i][j];
    }
    cout<<endl;
    count=0;
  }
  return 0;
}

#include <iostream>

using namespace std;

int main(){
	int n , i = 1 ,  tri = 0;
	cin >> n ;
	while(tri < n){
		tri= tri + i ;
		i ++ ;
	}
	if ( tri == n)
		cout << "yes" ;
	else
		cout << "no" ;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int n,F[505];
main(){
    cin>>n;
    for(int i=1;i<=501;i++){
        F[i]=(n+1)*n/2;
    }
    int id=lower_bound(F+1,F+502,n)-F;
    F[id]==n    ?   cout<<"YES" :   cout<<"NO";
}

#include<bits/stdc++.h>

using namespace std;

int main (){
    int a;
    cin >>a;
    if(a % 3 == 0|| a ==1)
    cout<<"YES";
    else cout<<"NO";
}

#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
if(n==1) cout<<"YES";
else if(n%3==0) cout<<"YES";
else cout<<"NO";
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,sum=0,cnt=0;
    cin>>n;
    for(i=0;i<n;i++)
    {
        sum=sum+i;
        if(sum==n)
        {
        cout<<"yes";

        }
        else
            cnt++;
    }
    if(cnt>n-1)
    {
        cout<<"NO";
    }

}

#include<stdio.h>
#include<string.h>
main()
{
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
int a;
scanf("%d",&a);
if(a%2==0)
{
    printf("NO");
}
else
{
    printf("YES");
}
}

#include <iostream>
#include <cmath>
using namespace std;

int main()
{
	int n;
	cin >> n;

	float tmp = 8*n+1;
	float temp = sqrt(float(8*n+1));
	int temp2 = (int(temp)-1)%2;

	if(temp*temp == tmp && tmp>= 9 && !temp2)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;

	return 0;
}

#include <iostream>
#define ll long long
using namespace std;
int main() {
    ll a;
    cin>>a;
    if (a%3==0||a==1)
        printf("%s","YES");
    else
        printf("%s","NO");
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,z=1;
	cin>>n;
	n=2*n;
	int a[200];
	for(int i=1;i<=n;i++){
	 if(n%i==0){ a[z]=i;z++;
	 }	}
	 if(a[z/2]-a[(z/2)-1]==1){ cout<<"YES";
	 }
	 else {
	 cout<<"NO";
	}
}

#include <bits/stdc++.h>

using namespace std;
int main(){

	int n;
	cin >> n;

	for (int i=0; i<n; i++)if(i*(i+1)/2 == n){
			cout<<"YES"<<endl;
			return 0;
		}
		cout<< "NO"<<endl;
}

#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string.h>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <assert.h>
#include <utility>
#define ms(a,b) memset(a,b,sizeof(a))
#define inf 1<<28
#define mp make_pair
#define pii pair<int,int>
#define fs first
#define sc second
#define pob pop_back
#define vec_ vector
#define clr(a) a.clear()
#define pb push_back
#define eps 1E-7
#define sf scanf
#define pf printf
#define all(a) a.begin(),a.end()
#define fop   freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define scch(a) scanf(" %c",&a)
#define scll1(a) scanf(" %I64d",&a)
#define scll2(a,b) scanf(" %I64d %I64d",&a,&b)
#define scll3(a,b,c) scanf(" %I64d %I64d %I64d",&a,&b,&c)
#define sci1(a) scanf(" %d",&a)
#define sci2(a,b) scanf(" %d %d",&a,&b)
#define sci3(a,b,c) scanf(" %d %d %d",&a,&b,&c)
#define scd1(a) scanf(" %lf",&a)
#define scd2(a,b) scanf(" %lf %lf",&a,&b)
#define scd3(a,b,c) scanf(" %lf %lf %lf",&a,&b,&c)
#define deb1(a) cout<<a<<endl;
#define deb2(a,b) cout<<a<<" "<<b<<endl
#define deb3(a,b,c) cout<<a<<" "<<b<<" "<<c<<endl
#define sz(a) a.size()
#define ll long long
#define ull unsigned long long
#define dd double
using namespace std;
//template <class T> T lcm(T a, T b){return (a/__gcd(a,b)) * b;}
//ll bigmod(ll a,ll b,ll m){if(b == 0) return 1%m;ll x = bigmod(a,b/2,m);x = (x * x) % m;if(b % 2 == 1) x = (x * a) % m;return x;}
//int X[]={0,-1,-1,-1,0,1,1,1};
//int Y[]={-1,-1,0,1,1,1,0,-1};
//int X[]={-1,0,1,0};
//int Y[]={0,1,0,-1};

///***************************************************** ekhon kamer kam ********************************************************************///

#define mt

int main ()
{
    int n;
    cin>>n;
    if(n==1 || !(n%3))
        cout<<"YES";
    else
        cout<<"NO";

    return 0;
}

#include <iostream>
using namespace std;

int main(){
	int n,s;
	cin>>n;
	bool b=false;
	for(int i=1;i<=35;i++){
		s=(i*(i+1))/2;cout<<s<<endl;
		if (s==n)b=true; else b=false;}
		if(n==1)b=true;
	if(b)cout<<"YES" ;else cout<<"NO";

	return 0;
	}

#include <iostream>

int main()
{
    int test_number;
    int start = 0;
    bool tri = false;

    std::cin >> test_number;

    for(int i = 0; i < 500; i++)
    {
        start += i;
        if(test_number == start)
        {
            tri = true;
            break;
        }
    }

    if(tri)
    {
        std::cout << "TRUE" << std::endl;
    }
    else
    {
        std::cout << "FALSE" << std::endl;
    }

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL)
int main()
{
    lli n , c = 0;
    cin >> n;
    for(int i = 1; i < 50; i ++)
    {
        if((i * (i + 1) / 2) == n)
        cout<<"YES";
        c++;
        break;
       // break;
    }
   if( c != 1)
   cout<< "NO";
}

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	n*=2;
	for(int i=0;i<n;i++){
		n-=i;
		if(sqrt(n)==(int)sqrt(n)){
			cout<<"YES";return 0;
		}
	}
	cout<<"NO";
	return 0;
}

/* In the name of ALLAH */

#include <bits/stdc++.h>
#define ll long long
#define int long long
#define endl '\n'
using namespace std;

const int MAXN = 1001 * 1001 , MOD = 1e9 + 7 ;

 main(){
     ios::sync_with_stdio(0);
     cin.tie(0);
     int n ;
     cin >> n ;
     for(int i = 1 ; i <= n + 100; i ++)
        if(i*(1+i)/2==n)
            return cout<<i,0;
     cout<<"NO";

}

#include <iostream>

using namespace std;

int main(){

    int n, i=1, sum=1;
    cin>>n;
    while (sum<n){
        i=i+1;
        sum=sum+i;
    }
    if (sum==n)
        cout<<"Yes\n";
    else
        cout<<"No\n";

    return 0;
}

#include <iostream>
using namespace std;
int main()
{
    int x ;

    cin>>x;
    for(int i=0;i<x;i++)
    {
        if((i*(i+1)/2)==x)
           {

            cout<<"yes";
            return 0;
           }

    }
            cout<<"no";

}

#include <stdio.h>

int main()
{
    unsigned int n, x, ans;

    scanf("%u", &n);

    for (x=n; x>0; x--)
        if(x*(x+1)==2*n)
        {
            ans=1;
            break;
        }
    ans==1? printf("YES"): printf("NO");
}

#include <iostream>

using namespace std;

int main()
{
    int x,i,a=0;
    cin>>x;
   for(int i=1; i<=x; i++)
   {

       i=(i*(i+1))/2;
       if(i==x)
        {
            a++;
          break;
        }

}
if(a!=0)
    cout<<"YES";
else
       cout<<"NO";

    return 0;
}

#include<iostream>
using namespace std;
int main ()
{
	int a,b,c,d;
	cin>>a;
	for (b=1;b<a;b++)
	if (a=b*(b+1)/2){
		cout<<"YES";
		return 0;
	}
	cout<<"NO"<<endl;
	return 0;
}

#include <algorithm>
#include <numeric>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <iostream>
#include <fstream>
#include <cmath>
#include <math.h>
#include <iomanip>
#include <stdlib.h>
#include <stack>
using namespace std;

#define FOR(i,n) for (int i=0; i<n; ++i)
#define FORE(i,n) for (int i=0; i<=n; ++i)
#define REP(i,a,b) for (int i=a; i<b; ++i)
#define REPE(i,a,b) for (int i=a; i<=b; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define FORSET(z,s) for(z=s.begin();z!=s.end;z++)
#define sqr(x) (x*x)
#define DEC(i,n) for(int i = n-1;i>=0;i--)
#define WAIT cin.get();cin.get();
#define ENDSYMB cin.get();
#define max(a,b) (a>b?a:b)
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long int LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
const double pi = acos(-1.0);
const int inf =(int) 1e9;
const double inf1 = 1e-9;
//const int p = 1000003;
void main()
{
    int n; cin>>n;
    if(n==1 || n ==3) {cout<<"YES"; return;}
    FOR(i,n/2)
    {
        if(i*(i+1) == 2*n) { cout<<"YES"; return;}
    }
    cout<<"NO";
    WAIT
    return;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int a = ceil(sqrt(n) * 1.0);
    bool flag = 0;

    while(a --) {
        int b = (a * (a + 1)) / 2;
        if(b == n) {
            flag = 1;
            break;
        }
    }
    if(flag) {
        cout << "YES";
    }
    else {
        cout << "NO";
    }
    return 0;
}

#include <iostream>
#include<cmath>

using namespace std;

int main()
{
int n;
double x;
cin>>n;
x=pow(8*n+1,0.5)-1;
if(fmod(x,2)==0)
{
    cout<<"YES"<<endl;
}
else
{
    cout<<"NO"<<endl;
}
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        if(i*(i+1)/23==n)
        {
            cout<<"YES"<<endl;
            return 0;
        }
    }
    cout<<"NO"<<endl;

    return 0;
}

#include <bits/stdc++.h>
typedef long long ll;
#define forn(i, a, b) for (ll i = a; i < ll(b); i++)
#define MOD 1000000007
#define see(param) cout << #param << " is : " << param << "\n";
#define all(x) (x).begin(),(x).end()
#define rev(x) reverse(all(x))
#define ALLKILL ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define TC ll T;cin>>T;while(T--)
using namespace std;

template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
bool isPal(string str){string s=str;reverse(all(str));if(s==str)return true;return false;}
bool isPrime(ll n){if(n==1 or(n>2 and n%2==0))return false;else{for(ll i=2;i*i<=n;i++)if(n%i==0)return false;return true;}}
bool odd(ll n){return n&1;}
ll gcd(ll a,ll b){return __gcd(a,b);}
ll lcm(ll a, ll b){return(a*b)/(__gcd(a, b));}
ll power(ll b, ll p){ll res=1;while(p){if (p & 1)res *= b;b = b * b;p/=2;}return res;}
ll powerMOD(ll b,ll p,ll mod=MOD){ll res=1;while(p!=0){if(p%2==0){b=(b*b)%mod;p/=2;}else{res=(res*b)%mod;p--;}}return res;}
ll powerStringMod(ll b, string p,ll mod=MOD){ll remB=0;for(ll i=0;i<p.length();i++)remB=(remB*10+p[i]-'0')%(mod-1);return powerMOD(b,remB,mod);}//if mod is Prime
#define N 3
ll I[N][N];
void mul(ll I[][N],ll A[][N],ll dim){ll res[dim+1][dim+1];forn(i,1,dim+1){forn(j,1,dim+1){res[i][j]=0;forn(k,1,dim+1){res[i][j]+=(I[i][k]*A[k][j]);}}}forn(i,1,dim+1){forn(j,1,dim+1){I[i][j]=res[i][j];}}}
void power(ll A[][N], ll dim, ll n){memset(I, 0,sizeof(I));forn(i, 1, dim+1){I[i][i]=1;}while(n){if(n&1)mul(I,A,dim);if(n==1)break;mul(A,A,dim);n/=2;}/*forn(i,1,n+1){mul(I, A, dim);}*/forn(i, 1, dim+1){forn(j,1,dim+1){A[i][j]=I[i][j];}}}

int32_t main()
{
    ALLKILL;
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // TC
    {
        ll n;
        cin >> n;
        ll st=1;
        while(1){
            if(n==(st*(st+1))/2){
                cout<<"YES\n";
                break;
            }
            else if((st*(st+1))/2 > n){
                break;
            }
        }
        cout<<"NO\n";
    }
    return 0;
}

#include <cstdio>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>
#include<stack>
#include<string>
#include <iostream>
#include<vector>
#include<string.h>
#include<bitset>
#include<math.h>
#include<queue>
using namespace std;
int a[10005];
int main()
{
    int i,j;
    int n,m,len,t,q,sum,p,MAX,y,x;
    for(i=1;i<=n;i++)
    {
        a[i*(i+1)/2]=1;
    }
    scanf("%d",&n);
    if(a[n])
        puts("YES");
    else
        puts("NO");
    return 0;

}
/*2017-08-08 19:05:03.935*/

#include<stdio.h>
int main(){
	int n,i,temp,f=0;
	scanf("%d",&n);
	if(n==1){
		printf("YES");
		_Exit(0);
	}
	else{
		for(i=1;i<n;i++){
			temp=(i*(i+1))/2;
			if(n==temp){
				printf("YES");
				f=1;
				break;
			}
		}
}
	if(f==0)
		printf("NO");
	return 0;
}

#include <iostream>
using namespace std;
int main()
{
   int n; // n = given integer
   /*int c = 1;
   cin >> n;

   for(int i = 1; c <= n; i++, c += i)
        if(c == n)
        {
            cout << "YES" << endl;
            return 0;
        }

    cout << "NO" << endl;

    return 0;*/
    cin >> n;
    if(n % 2 == 0)
      cout << "NO";
   else
      cout << "YES";
   return 0;
}

#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <queue>
#include <string>
#include <map>
#include <sstream>
#include <fstream>
#include <hash_map>
#define input fstream fin( "input.txt" , ios :: in ) ;
 #define output fstream fout( "output.txt" , ios :: out ) ;

#define FOR(s,x) for ( long long i = s ; i < x ; i ++ )
#define FOR2(s,x) for ( long long j = s ; j < x ; j ++ )
#define FOR3(s,x) for ( long long r = s ; r < x ; r ++ )
#define FOI(s,x) for ( long long d = x ; d >= s ; d -- )
#define SZ  size()
#define B    begin()
#define E    end()
#define p(s)    push_back(s)
using namespace std;
int find(   vector<int> dist , int num ){

    FOR(0, dist.size())
        if ( num == dist[i])
        return i ;

    return -1 ;

}
   long long n , m , res = 0 , res2 = 0, num , sum = 0 , sum2 = 0, c = 0  ;
   long long mx = 0 , mn = INT_MAX ;
 //  vector <int> ans ;
   string s = "" , s2 = "" ;
   int arr[1001] ;
int main()
{
 cin >> n ;
 long long tn = ( n*(n+1)) / 2 ;
  FOR (1 , tn+1)
{
    if (i * (i + 1) / 2 == tn)
    {
        cout << "YES\n";
        return 0 ;
    }
}
cout << "NO\n";

}

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	for(int i=1;n>i;i++)
	{
		if(i*(i+1)/2==n)
		{
			cout<<"YES";
			return 1;
		}

	}
	cout<<"NO";
	return 0;

}

#include <iostream>

using namespace std;

int main()
{
  int i;
  cin >> i;
  if (i%3==0 && i!=12 || i==1){
    cout << "YES";
  } else {
  cout << "NO";
  }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,sum=0,cnt=0;
    cin>>n;
    for(i=0;i<n;i++)
    {
        sum=sum+i;
        if(sum==n)
        {
        cout<<"YES";
        }
        else
            cnt++;
    }
    if(cnt>n-1)
    {
        cout<<"NO";
    }

}

#include<stdio.h>
#include<string.h>
main()
{
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
int a;
scanf("%d",&a);
if(a%2==0)
{
    printf("NO");
}
else
{
    printf("YES");
}
}

#pragma comment(linker,"/stack:67108864")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <sstream>
#include <fstream>
#include <climits>
#include <cfloat>
#include <functional>
#include <ctime>
#include <numeric>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <utility>
#include <bitset>
#include <string>
#include <list>
#include <stack>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <typeinfo>
#include <cassert>
#include <ctime>

using namespace std;

#define mp make_pair
#define pb push_back
#define all(v) (v).begin(),(v).end()

const bool TM=false;

int t[33];
int n,i;

int main(){
    if(TM) {freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);}

    for (i=0;i<33;i++){
        t[i]=i*(i+1)/2;
    }
    for (i=0;i<33;i++){
        if(t[i]==n) {cout << "YES";return 0;}
    }
    cout << "NO";
    return 0;
}

#include<stdio.h>
int main()
{
int a;
scanf("%d",&a);
if((a*(a+1))/2==a)
printf("YES\n");
else
printf("NO\n");
return 0;
}

#include<iostream>
using namespace std;
int main(){
	int n, x[500], y;
	cin >> n;
	for (int i = 1; i < 501; i++){
		x[i] = i;
		y = x[i] * (x[i] + 1) / 2;

		if (n == y)
			cout << "yes";
		else{
			cout << "no";
		}
	}
	cin.get();
	cin.get();
	return 0;
}

#include <iostream>
#include<math.h>

using namespace std;

int main()
{
    int n,m;
    double x;
    cin>>n;
    x=(sqrt(8*n+1)-1);
    m=x/2;

    if(m%2==0)
        cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,sum=0;
  cin>>n;
  if(n/3==0||n%9==1)
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;

}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a;
    cin>>a;
    if(a==0 || a==1)
    {
        cout<<"YES\n";
    }
    else if (a%3==0 || a%3==1)
    {
        cout<<"YES\n";
    }
    else if (a==4)
        cout<<"NO\n";
    else
     cout<<"NO\n";

}

#include <bits/stdc++.h>

using namespace std;

int n, t[250];

int main(){
	t[1] = 1;
    for(int i = 2; i <= 250; i++) t[i] = t[i-1]+i;
    cin >> n;
    for(int i = 1; i <=250; i++) if(t[i] == n) return cout << "YES", 0;
	cout << "NO";
	return 0;
}

#include<iostream>
#include<string >
using namespace std;
int main()
{
	int n;
	bool find=false;
	cin>>n;
	for(int i=0 ; i< n+1 ; i++)
	{
		if((i*(i+1))/2 == n)
		{
			cout<<"YES";
			find=true;
		}
	}
	if(!find)
	{
		cout<<"No";
	}
	return 0;
}

#include<iostream>
using  namespace  std;
int   main()
{
    int n,i;
    cin>>n;
    if(n=i*(i+1)/2)
    cout<<"YES";
    else
    cout<<"NO";
    return   0;
}

#include<cstdio>
#include<cstdlib>
int n;
int main() {
	scanf("%d",&n);
	if(n==1) printf("YES");
	if(n==2) printf("NO");
	if(n>2) printf("YES");

	return 0;
}

#include <iostream>
#include <string>
#include <sstream>
using namespace std;
int main()
{
	int num,k=0;
	cin >> num;
	for (int n=1;n<=num;n++)
		if (((n*(n+1))/2)==num)
			cout << "YES";
			k=k+1;
	if (k==0)
		cout << "NO";
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
long long n;
int main(){
	scanf("%lld",&n);
	n=n*2;
	for(register int i=1;i<=10000000;i++)
		if(i*(i+1)==n){
			cout<<"YES"<<endl;
			return 0;
		}
	cout<<"NO"<<endl;
	return 0;
}

#include<iostream>
#include<cmath>

using namespace std;

int main(){

	long long triangulares[500];
	int n, i;
	bool triangular;

	for (i=0; i<500; i++){
		triangulares[i] = (i*(i+1))/2;
	}
	cin>>n;
	if (n>=1 || n<=500){
		for(i=0; i<=n; i++){
			if (n == triangulares[i]){
				triangular = true;
			}
		}
		if (triangular){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}
	return 0;
}

#include <iostream>

using namespace std;

int main()
{
   int n;
   cin>>n;
   if(n%3==1||n%3==0)
    cout<<"YES";
   else
    cout<<"NO";
}

#include<iostream>
#include<string>
#include<cstring>
#include<stdlib.h>
#include<stdio.h>
#include <algorithm>
#include<iomanip>
using namespace std;
struct no{
	int r;
	int l;
	int p;
};
int main(){
//	freopen("input.txt","r",stdin);
//	freopen("output.txt","w",stdout);
	int n;
	cin>>n;
	if(n == 1 || n%3 == 0)
		cout<<"YES"<<endl;
	else
		cout<<"NO"<<endl;

	return 0;
}

#include <iostream>

using namespace std;
int main()
{
    int n,i;
    cin>>n;
    int rr=0;
    for( i=1;i<n;i++)
    if(((i*(i+1))/2)==n){
    rr=1;
    cout<<"YES"<<endl;

    }
    if(rr==0)
    cout<<"NO"<<endl;

    return 0;
}

#include <iostream>
using namespace std;
int n,x;
bool t=false;
int main () {
	cin>>n;
	for (x=0;x<n;x++) {
		if (x*(x+1)/2==n) t=true;
	}
	if (t==true) cout<<"YES"<<endl;
	else
	if (t==false) cout<<"NO"<<endl;
	return 0;
}

#include <iostream>

using namespace std;

int main()
{
    int n, s, i(0);

    cin>>n;
    for(int i(0); i<1000; i++)
    {
        s=s+i;
        cout<<s<<" "<<endl;
        if(s==n)
        {
            cout<<"YES"<<endl;
            break;
        } else if(s>n)
        {
            cout<<"NO"<<endl;
            break;
        }

    }

}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int sum=1;
    int i=2;
    int flag=1;
    if(sum<=n)
    {
        if(sum==n)
        {
            cout<<"YES\n";
            flag=0;

            }
        sum+=sum+i;
        i++;
    }
    if(flag==1)cout<<"NO\n";
}

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

int main()
{
    int n1, n2, tn;
    cin>>tn;
    n1 = (1+(sqrt(1+(8*tn))));
    n2 = (1+(sqrt(1+(8*tn))));

    if(((n1&1)==0)||((n2&1)==0)) cout<<"YES";
    else cout<<"NO";
    return 0;
}

#include <fstream>
#include <iostream>
#include <string>

int main() {

  int n;
  std::cin >> n;

  std::string result = "NO";
  for (int i = 0; i < n; i++) {
    if ((i * (i + 1)) == n * 2) {
      result = "YES";
    }
  }
  std::cout << result << std::endl;
  return 0;
}

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include<cmath>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
int n;
cin>>n;
if(n==1||n%3==0) cout<<"YES";

else{
    cout<<"NO";
}
    return 0;
}

#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <float.h>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <locale>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <wchar.h>
#include <wctype.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cerrno>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <limits>
#include <map>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <istream>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <utility>
#include <vector>
#include <cwchar>
#include <cwctype>
#include <complex.h>
#include <fenv.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stdint.h>
#include <tgmath.h>
#include <conio.h>
#include <numeric>
#include <list>
#include <windows.h>
using namespace std;

int main()
{
	int sum=0,n;
	cin>>n;
	for(int i=1;i<30;i++)
	{
		sum+=i;
		if(sum==n) {cout<<"YES";return 0;}
	}
	cout<<"NO";
	return 0;
}

#include <iostream>;
#include <math.h>;
#include <string>;

using namespace std;

int main()
{
    int n;

    cin>>n;

    if(n==1){cout<<"YES";}
    else
    {
        if ((n-3)%3==0){cout<<"YES";}
        else{cout<<"NO";}
    }
}

#include"bits/stdc++.h"
using namespace std;
const int N =5e5 + 5;
int n ;

int main() {

scanf("%d",&n);

if(n==1){
    printf("1");
    return 0;
}

for(int i =2 ; i<500; ++i ){
    if((2*n)%i==0  && (2*n)%(i+1)==0){
        printf("YES");
        return 0;
    }
}

printf("NO\n");
}

#include <iostream>
#include<math.h>

using namespace std;

int main()
{
    int n,m;
    double x;
    cin>>n;
    x=(sqrt(8*n+1)-1);
    m=x/2;

    if(m%2==0)
        cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

//Author: master19
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define endl "\n"
#define PI acos(-1.0)
#define len(x) x.size()
#define mod 1000000007LL
#define x(arr) arr.begin(),arr.end()
#define ulli unsigned long long int
#define assign(x,val) memset(x,val,sizeof(x))
#define prec(val, dig) fixed << setprecision(dig) << val
#define vil(vct) vector < ll > vct
#define vis(vct) vector < string > vct
#define vip(vct) vector < pair < ll, ll > > vct
#define Sort(arr) sort(arr.begin(), arr.end())
#define lower(str) transform(str.begin(), str.end(), str.begin(), ::tolower);
#define upper(str) transform(str.begin(), str.end(), str.begin(), ::toupper);
#define crap ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define get(arr, num) vector < ll > arr(num); for(int i=0; i<num; i++)cin >> arr[i];
#define put(arr, num) for(int i=0; i<num; i++)cout << arr[i] << " "; cout << endl;
#define get_set(arr, num, st, type) set < type > st; for(int i=0; i<num; i++) st.insert(arr[i]);
#define dbg(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl;
// pi xy[] = {{-1, 0}, {1, 0} , {0, -1}, {0, 1}};
// pi dig[] = {{-1, -1}, {-1, 1}, {1, 1}, {1, -1}};
// bool isValid(ll x, ll y, ll row, ll col){
//     return ((x>=0) && (y >=0)  && (x < row) && (y < col));
// }
int main(){
    crap;
    ll test = 1;
    // cin >> test;
    for(int loop=0; loop<test; loop++){
        ll num;
        for(int i=1; i<num; i++){
            if(((i+1)*i) /2 == num){
                cout << "YES\n"; return 0;
            }
        }
    }
    cout << "No\n";
}

#include <iostream>
using namespace std;
int main()
{
    int i,n;
    int t[510];
    cin>>n;

    for( i=0; i<=n; i++)
    {
        t[i]=i*(i+1)/2;
        if (t[i]==n)
        {
            cout<<"yes";
            return 0;
        }
     }
            cout<<"no";

    return 0;
}

#include<iostream>
using namespace std;
#include<math.h>
int main()
{int n,d;
double x ;
cin>>n;
d=1+8*n;
if (d<0) cout<<"NO";
else {
       x=((-1+sqrt(d))/2);
         if( floor(x)==x)
         cout<<'YES';
       else cout<<"NO"; }
return(0);}

#include<iostream>
using namespace std;

int main()
{
  long long a;
  cin >> a;
  if ( a % 2 != 0 && a != 5 ){
  cout << "YES";
  }
   else{
      cout << "NO";
   }
}

#include <iostream>
#include <cmath>

using namespace std;

int main()
{ int n;
  float y,c;
cin>>n;
y= sqrt((8*n)  +1)-1;
y=y/2;

c=y*10;
if (fmod (c ,10)==0)
    cout<<"yes";
else
    cout<<"no";

    return 0;

}

#include <iostream>
#include<bits/stdc++.h>
using namespace std;
long long int y,n;
int main()
{
    cin>>n;
    y=n*(n+1)/2;
    if(y%n==0)
    {
        cout<<"YES";
    }
    else
    {
        cout<<"NO";
    }
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int x;
    cin>>x;
    if(x%2==0){
        cout<<"NO";
    }else{
    cout<<"YES";
    }
    return 0;
}

/*******************************
* BASMILLAHHIR RAHMANNIR RAHIM *
* MD SHAHINUR RAHMAN           *
* DATE: 16/oct/2020            *
* DEPT. OF CSE                 *
* LEADING UNIVERSITY, SYLHET   *
*******************************/
#include<bits/stdc++.h>
#include<vector>
#include<algorithm>
#include<string>
#include<stdlib.h>
#include<math.h>
#define shahin std::ios_base::sync_with_stdio(false); std::cin.tie(NULL);
#define ll long long
#define pb push_back
#define sz(x) (int)(x).size()
const int nax=1000*1007;
const int mod = 1e9 + 7;
int ar[120][120];
using namespace std;
char wcz[nax];
int w[200],s1=0,s2=0;

bool fu(int a, int b){
    return (a>b);
}
int gcd(int x,int y){
    return x?gcd(y%x, x):y;
}

bool isprime(int x){
                for(int i=2;i<x;i++){
                                if(x%i==0){
                                return false;
                                }
                }
                return true;
}

void fun1(){
        int n;
        cin >> n;
        if(n%2==0)cout<<"NO\n";
        else cout << "YES\n";

}

void fun(){
    ll sum=0,c=0,n,m;
    cin  >> n >> m;
    ll a[n];
    for(int i=0;i<n;i++){
                    cin >> a[i];
                    sum += a[i];
    }
    if(sum==m)cout << "YES"<< "\n";
    else cout << "NO" << "\n";

}
int main()
{
    shahin
    /*ll tc,i=1,m=-100000,sum=0,A=0,B=-1000000;
    cin >> tc;
    while(tc--)
    {
   // cout << "Case " << i << ": ";
        fun1();
     //   i++;
    }*/

    fun1();
}

#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=1;i<=n/2;i++)
 {
        if(i*(i+1)==2*n) cout<<"YES";
        else cout<<"NO";
    }
    return 0;
}

#include<stdio.h>
#include<string.h>
main()
{
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
int a;
scanf("%d",&a);
if(a%2==0)
{
    printf("NO");
}
else
{
    printf("YES");
}
}

#include<iostream>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int i,p;
    for(i=1;i*i<=n;i++)
    {
        p=i*(i+1);
        p=p/2;
        if(p==n)
        {
            cout<<"YES";
        }
    }
    if(i*i>n)
    {
        cout<<"NO";
    }

}

#include<bits/stdc++.h>
using namespace std;
int n,i,j;
int main(){
	scanf("%d",&n);
	printf("%d %d\n",i,j);
	if(i*(i+1)/2==n||j*(j+1)/2==n)puts("YES");
	else puts("NO");
}

#include <iostream>
using namespace std;
int n,x;
bool t=false;
int main () {
	cin>>n;
	for (x-0;x<n;x++) {
		if (x*(x+1)/2==n) t=true;
	}
	if (t==true) cout<<"yes"<<endl;
	else
	if (t==false) cout<<"no"<<endl;
	return 0;
}

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

int main() {
	// your code goes here
    int n;
    cin >> n ;
    if(n%6 == 3 || n%9 == 1 || n%9 == 3 ){
    	cout << "YES";
    }
    else {
    	cout <<"NO";
    }
	return 0;
}

#include<iostream>
using namespace std;
int main( )
{
  int i,n;
  cin>>n;
  for (i=1;i<=n+10;++i)
    {
      if (i*(i-1)/2==n)
        {
          cout<<"YES";
		}
	}
  cout<<"NO";
  return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <map>
#include <cmath>
#include <queue>
#include <iomanip>
#include <bitset>
#include <unordered_map>
#include <stack>
#include <memory.h>
#include <list>
#include <numeric>
#include <functional>
#include <complex>
#include <cassert>
#include <regex>

#define ll long long
#define ld long double
#define ull unsigned ll
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pii pair<int,int>
#define pll pair<ll>
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pii>
#define vvi vector<vector<int>>
#define vvll vector<vector<ll>>
#define forn(it,from,to) for(int (it)=from; (it)<to; (it)++)

using namespace std;

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);

	int n;
	cin >> n;
	int t = 1;
	while (t * t < n)
	{
		if ((t * (t + 1) / 2) == n)
		{
			cout << "YES";
			return 0;
		}
		t++;
	}
	cout << "NO";
	return 0;
}