#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, i, j, flag;
  long long int a, ans = 0, val, tmp, dig, num, x, y;
  cin >> a;
  flag = 0;
  tmp = a;
  while (flag != 1) {
    tmp++;
    ans++;
    num = abs(tmp);
    while (num > 0) {
      if (num % 10 == 8) {
        flag = 1;
        break;
      }
      num /= 10;
    }
  }
  cout << ans;
  return 0;
}
