#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define all(A) A.begin(),A.end()
typedef long long ll;

bool con7(int n){
  int t = n;
  while(t>0){
    if(t%10 == 7) return 0;
    t /= 10;
  }
  while(n>0){
    if(n%8 == 7) return 0;
    n /= 8;
  }
  return 1;
}

int main(){
  int n;
  cin >> n;
  int ans = 0;
  rep1(i,n) ans += con7(i);
  cout << ans << endl;
}

#include <bits/stdc++.h>

/////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//////////////////////////////////SOLVE HOJA PLZZ///////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////  Sushil Kumar  //////////////////////////////
//////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////

using namespace std;
#define ll long long

#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define si set<int, greater<int>>
#define pll pair<ll, ll>
#define vl vector<ll>
#define mii map<int, int>
#define mll map<ll, ll>
#define pqb priority_queue<int>
#define pqs priority_queue<int, vector<int>, greater<int>>
#define setbits(x) __buildin_popcountll(x)
#define mod 1000000007
#define inf 1e18
#define ps(x, y) fixed << setprecision(y) << x
#define w(t)  \
    int t;    \
    cin >> t; \
    while (t--)
#define lcm(x, y) (x * y) / __gcd(x, y)
#define gcd(x, y) __gcd(x, y)
bool prime(ll x)
{
    if (x == 2)
    {
        return true;
    }
    if (x <= 1)
    {
        return true;
    }
    for (int i = 2; i <= sqrt(x); i++)
    {

        if (x % i == 0)
        {
            return false;
        }
    }
    return true;
}
void printa(ll a[], ll n)
{
    for (ll i = 0; i < n; i++)
    {
        cout << a[i] << " ";
    }
    cout << endl;
}
void printv(vl v)
{
    for (int i = 0; i < v.size(); i++)
    {
        cout << v[i] << " ";
    }
    cout << endl;
}
#ifndef ONLINE_JUDGE
#endif

string Y = "YES\n";
string N = "NO\n";

/*
    abs(x-y) will give the absolute difference between two numbers
    __gcd(a,b) will give the gcd of two numbers
    max({a,b,c,d}) will give the maximum number amongst specified numbers
    round(a) will round the number to nearest integer value
    sqrt(x) will give square root of x but it gives output in double
    cbrt(x) will give cube root of x but it gives output in double
    lower_bound(vec.begin(),vec.end(),a) will give the index of the first element in specified range which is just smaller than specified number.
*/
void solve(ll x)
{
   
    if (x%2==1)
    {
        cout << "Odd" << endl;
    }
    
    else
    {

if ((x/2)%2==0)
{
        cout << "Even" << endl;
}
else{

        cout << "Same" << endl;
}

    }
}

signed main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    ll t;
    cin >> t;

    while (t--)
    {

        ll n;
        cin >> n;
        solve(n);
    }
}
