#include <bits/stdc++.h>
using namespace std;
int n, a, i = 1, j, b;
int main() {
  scanf("%d", &n);
  while (i < 1100000000) {
    n++;
    b = n;
    while (b != 0) {
      a = b % 10;
      if (a == 8 || a == -8) {
        printf("%d\n", i);
        return 0;
      }
      b /= 10;
    }
    i++;
  }
  return 0;
}
