#include <bits/stdc++.h>
using namespace std;
int main() {
  long long i, j, neg = 0, n, sum = 0, k;
  int count = 1;
  cin >> n;
  bool b = false;
  for (i = n + 1; i <= n + 1000; i++) {
    k = i;
    while (k != 0) {
      int c = k % 10;
      if (c == 8 || c == -8) {
        b = true;
        break;
      }
      k = k / 10;
    }
    if (b == true) {
      cout << count;
      break;
    }
    count++;
  }
}
