#include <bits/stdc++.h>
using namespace std;
template <class TH>
void _dbg(const char *sdbg, TH h) {
  cout << sdbg << " = " << h << endl;
}
template <class TH, class... TA>
void _dbg(const char *sdbg, TH h, TA... a) {
  while (*sdbg != ',') cout << *sdbg++;
  cout << " = " << h << ", ";
  _dbg(sdbg + 1, a...);
}
const long long mod = 1e9 + 7;
const long long M = 1e6 + 5;
const double pi = acos(-1.);
const long long dx[] = {1, 0, -1, 0, -1, -1, 1, 1};
const long long dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
long long x, y, z, maxi, mini, ans, mid, low, high, m, n, a, b;
string s1, s2;
bool check(long long p) {
  p = abs(p);
  while (p) {
    int k = p % 10;
    if (k == 8) return true;
    p /= 10;
  }
  return false;
}
void solve() {
  cin >> n;
  x = n;
  x++;
  while (!check(x)) x++;
  cout << abs(x - n);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
