#include <bits/stdc++.h>
int main() {
  long long int m, n, f = 0, i, j;
  scanf("%lld", &n);
  m = i = n;
  while (!f) {
    n = ++i;
    j = i >= 0 ? i : -i;
    while (j) {
      if (j % 10 == 8) {
        f = 1;
        break;
      }
      j /= 10;
    }
  }
  printf("%lld\n", n - m);
  return 0;
}
