#include <bits/stdc++.h>
using namespace std;
int main() {
  int flag = 0;
  int n, m, i, c = 0;
  cin >> n;
  m = n;
  for (i = n + 1; i < n + 17; i++) {
    c++;
    m = i;
    if (m < 0) m *= -1;
    while (m > 0) {
      long long d = m % 10;
      if (d == 8) flag = 1;
      m /= 10;
    }
    if (flag == 1 && i != n) {
      cout << c;
      break;
    }
  }
  return 0;
}
