#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, i, t = 0, p, q, p1;
  cin >> n;
  n++;
  p1 = 0;
  while (p1 != 1) {
    p = n;
    if (p < 0) p *= -1;
    while (p != 0) {
      q = p % 10;
      p = p / 10;
      if (q == 8) p1 = 1;
    }
    n++;
    t++;
  }
  cout << t++;
  return 0;
}
