#include <bits/stdc++.h>
int main(void) {
  long long a, temp;
  int b, count = 0, count1 = 0, flag = 0;
  scanf("%lld", &a);
  while (1) {
    a++;
    count++;
    temp = a;
    if (temp < 0) temp = -temp;
    while (temp > 0) {
      b = temp % 10;
      temp = temp / 10;
      if (b == 8) {
        flag = 1;
        break;
      }
    }
    if (flag == 1) break;
  }
  printf("%d", count);
  return 0;
}
