#include <bits/stdc++.h>
using namespace std;
int b, ans, r;
bool x;
int main() {
  cin >> b;
  while (!x) {
    b++;
    ans++;
    r = abs(b);
    if ((r - 8) % 10 == 0 && r != 0) x = 1;
    r /= 10;
    if ((r - 8) % 10 == 0 && r != 0) x = 1;
    r /= 10;
    if ((r - 8) % 10 == 0 && r != 0) x = 1;
    r /= 10;
    if ((r - 8) % 10 == 0 && r != 0) x = 1;
    r /= 10;
    if ((r - 8) % 10 == 0 && r != 0) x = 1;
    r /= 10;
    if ((r - 8) % 10 == 0 && r != 0) x = 1;
    r /= 10;
    if ((r - 8) % 10 == 0 && r != 0) x = 1;
    r /= 10;
    if ((r - 8) % 10 == 0 && r != 0) x = 1;
    r /= 10;
    if ((r - 8) % 10 == 0 && r != 0) x = 1;
    r /= 10;
    if ((r - 8) % 10 == 0 && r != 0) x = 1;
    r /= 10;
    if ((r - 8) % 10 == 0 && r != 0) x = 1;
    r /= 10;
  }
  cout << ans;
  return 0;
}
