#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cmath>
#include <stack>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <queue>
#include <set>
#include <fstream>
#include <list>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <ctime>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/detail/standard_policies.hpp>

using namespace std;
#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:16777216")
#define for0(i, n) for(int i = 0; i < n; i++)
#define for1(i, n) for(int i = 1; i <= n; i++)
#define _DEBUG
#define vec vector
#define pb push_back
#define en '\n'
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<ll, ll> pull;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef long double ld;
typedef unsigned int ui;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vi2;
typedef vector<vector<ll>> vll2;
typedef vector<vector<ll>> matrix;
typedef vec<vec<vec<int>>> vi3;

#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:16777216")
#define pb push_back
#define en '\n'
#define for0(i,n) for(int i = 0;i<n;i++)
#define for1(i,n) for(int i = 1;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define vec vector
#define pii pair<ll,ll>
#define pll pair<ll,ll>
#define REP(a,i,b) for (int i = a;i<b;i++);

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")

const int inf = 2000000000;
const ll linf = 5000000000000000000;
const ld LDINF = 2e18;
template<typename T> void print(vector<T>& a)
{
    for (int i = 0; i < a.size(); i++)
        cout << a[i] << ' ';
}

template<typename T> void print(deque<T>& a)
{
    for (int i = 0; i < a.size(); i++)
        cout << a[i] << ' ';
}

template<typename T> void print(vector<vector<T>>& a)
{
    for (int i = 0; i < a.size(); i++)
    {
        for (int j = 0; j < a[i].size(); j++)
            cout << a[i][j] << ' ';
        cout << en;
    }
}

template <typename T> void input(vector<T>& a)
{
    for (int i = 0; i < a.size(); i++)
        cin >> a[i];
}

template<typename T> void input(deque<T>& a)
{
    for (int i = 0; i < a.size(); i++)
        cin >> a[i];
}

template<typename T> void input(vector<vector<T>>& a)
{
    for (int i = 0; i < a.size(); i++)
        for (int j = 0; j < a[i].size(); j++)
            cin >> a[i][j];
}

ll mod =  1190494759;
int mod1 = 1e9 +7;
ll p = 103;

ll gcd(ll a, ll b){
    if(b == 0)
        return a;
    return gcd(b, a%b);
}

ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

matrix mult(matrix &A, matrix &B){
    int n = A.size(), m = B[0].size();
    matrix C(n, vec<ll>(m, 0));
    for0(i, n){
        for0(j, m){
            for0(k, A[0].size()){
                C[i][j] += A[i][k] * B[k][j];
                C[i][j] %= mod;
            }
        }
    }
    return C;
}

ll BinPow(ll a, ll n){
    if(n == 1)
        return a;
    if(n == 0)
        return 1;
    if(n % 2 == 0){
        ll d =BinPow(a, n/2);
        return d * d % mod;
    }
    else
        return a * BinPow(a, n-1) % mod;
}

struct event{
    int num, type, x;
};

bool cmp(event &a, event &b){
    if(a.x == b.x){
        return a.type > b.type;
    }
    return a.x < b.x;
}

ll toDec(string &num){
    reverse(all(num));
    ll ans = 0;
    ll st = 1;
    for(char ch : num){
        ll bit = ch-'0';
        ans += st * bit;
        st *=2;
    }
    return ans;
}

int GetVal(int n){
    bitset<8> bit = n;
    string num;
    for(int i = 0;i < 8; i++){
        if(bit[i])
            num.push_back('1');
        else
            num.push_back('0');
    }
    return toDec(num);
}

void solve()
{
    int last = 0;
    string str;
    getline(cin, str);
    for(int i = 0; i < str.length(); i++){
        int itog = GetVal(last);
        int rever = GetVal(int(str[i]));
        int x = itog - rever;
        if(x < 0)
            x += 256;
        cout << x << en;
        last = int(str[i]);
    }
}

int main()
{

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

#ifdef DEBUG
     freopen("input.txt", "r", stdin);
     freopen("input.txt", "r", stdin);
#endif
   // freopen("graph.in", "r", stdin);
   // freopen("graph.out", "w", stdout);

    int tst = 1;
  //  cin >> tst;
    while(tst--)
        solve();

}


#include<stdio.h>
int reverse (int ch)
{
    int i,j, res = 0;
    for (i=0, j=7; i<8; ++i,--j)
    {
        if ((ch&(1<<i))) res |= (1<<j);
    }
    return res;
}
int convert(int ex, int now)
{
    int res = ex - reverse(now);
    if (res<0) res += 256;
    res = res % 256;
    return res;
}
char str[103];
int main()
{
    gets(str);
    int i, prev = 0, x;
    for (i=0; str[i]; ++i)
    {
        x = convert(prev, str[i]);
        printf("%d\n",x);
        prev = reverse(str[i]);
    }
    return 0;
}


#include <iostream>
#include <string>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
#define rep(s,e) for(int i=s;i<e;i++)
#define ll long long
int gharine(int n)
{
	string ans="";
	if (n == 256)
		return 1;
	rep(0,8)
	{
		ll tavan = pow(2.0,7-i*1.0);
		if (n >= tavan)
		{
			ans += '1';
			n -= tavan;
		}
		else ans += '0';
	}
	string ans2="";
	rep(0,8)
	{
		ans2 += ans[7-i];
	}
	ll ans3 = 0;
	ll tavan = 1;
	for (int i=ans2.length()-1;i>=0;i--)
	{
		if (ans2[i] == '1')
			ans3 += tavan;
		tavan *= 2;
	}
	return ans3;
}
int main()
{
	string s;
	getline(cin,s);
	int code[100];
	ll k = gharine(s[0]);
	code[0] = -1 * k;
	code[0] = 256 + code[0];
	cout << code[0] << endl;
	code[0] = k;
	rep(1,s.length())
	{
		k = gharine(s[i]);
		code[i] = code[i-1] - k;
		code[i] = (code[i] < 0 ? 256 + code[i] : code[i] % 256);
		cout << code[i] << endl;
		code[i] = k;
	}
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

#define SIZE(X) ((int)(X.size()))//NOTES:SIZE(
#define LENGTH(X) ((int)(X.length()))//NOTES:LENGTH(
#define MP(X,Y) make_pair(X,Y)//NOTES:MP(
#define FORD(i, a, b) for(int i=(a); i<(b); i++)
#define FORS(i, a) for(int i=(0); i<SIZE(a); i++)
typedef long long int64;//NOTES:int64
typedef unsigned long long uint64;//NOTES:uint64
#define two(X) (1<<(X))//NOTES:two(
#define twoL(X) (((int64)(1))<<(X))//NOTES:twoL(
#define contain(S,X) (((S)&two(X))!=0)//NOTES:contain(
#define containL(S,X) (((S)&twoL(X))!=0)//NOTES:containL(
const double pi=acos(-1.0);//NOTES:pi
const double eps=1e-11;//NOTES:eps
template<class T> inline T sqr(T x){return x*x;}//NOTES:sqr
typedef pair<int,int> ipair;//NOTES:ipair
template<class T> inline T lowbit(T n){return (n^(n-1))&n;}//NOTES:lowbit(
template<class T> inline int countbit(T n){return (n==0)?0:(1+countbit(n&(n-1)));}//NOTES:countbit(

typedef unsigned char uchar;

bool get(uchar ch, int i)
{
  return (ch & (1<<i)) == 0 ? false : true;
}

void set1(uchar& ch, int i, bool flag)
{
  if(flag)
    ch |= (1<<i);
  else
    ch &= ~(1<<i);
}

void Mirror(uchar& ch)
{
  for(int i=0; i<4; ++i)
  {
    bool b1 = get(ch, i);
    bool b2 = get(ch, 7-i);
    set1(ch, i, b2);
    set1(ch, 7-i, b1);
  }
}

void main()
{
  map<uchar, map<uchar, uchar> > Mem;
  for(int i=0; i<256; ++i)
  {
    for(int j=0; j<256; ++j)
    {
      uchar pr = i;
      uchar cur = j;
      uchar mod = i-j;
      Mem[mod][pr] = cur;
    }
  }

  uchar ch, pr = 0;
  cin.unsetf(ios_base::skipws);
  while(cin >> ch)
  {
    uchar curPr = ch;

    Mirror(ch);
    Mirror(pr);
    pr = Mem[ch][pr];
    cout << (unsigned int)pr << endl;

    pr = curPr;
  }
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

#define SIZE(X) ((int)(X.size()))//NOTES:SIZE(
#define LENGTH(X) ((int)(X.length()))//NOTES:LENGTH(
#define MP(X,Y) make_pair(X,Y)//NOTES:MP(
#define FORD(i, a, b) for(int i=(a); i<(b); i++)
#define FORS(i, a) for(int i=(0); i<SIZE(a); i++)
typedef long long int64;//NOTES:int64
typedef unsigned long long uint64;//NOTES:uint64
#define two(X) (1<<(X))//NOTES:two(
#define twoL(X) (((int64)(1))<<(X))//NOTES:twoL(
#define contain(S,X) (((S)&two(X))!=0)//NOTES:contain(
#define containL(S,X) (((S)&twoL(X))!=0)//NOTES:containL(
const double pi=acos(-1.0);//NOTES:pi
const double eps=1e-11;//NOTES:eps
template<class T> inline T sqr(T x){return x*x;}//NOTES:sqr
typedef pair<int,int> ipair;//NOTES:ipair
template<class T> inline T lowbit(T n){return (n^(n-1))&n;}//NOTES:lowbit(
template<class T> inline int countbit(T n){return (n==0)?0:(1+countbit(n&(n-1)));}//NOTES:countbit(

typedef unsigned char uchar;

bool get(uchar ch, int i)
{
  return (ch & (1<<i)) == 0 ? false : true;
}

void set1(uchar& ch, int i, bool flag)
{
  if(flag)
    ch |= (1<<i);
  else
    ch &= ~(1<<i);
}

void Mirror(uchar& ch)
{
  for(int i=0; i<4; ++i)
  {
    bool b1 = get(ch, i);
    bool b2 = get(ch, 7-i);
    set1(ch, i, b2);
    set1(ch, 7-i, b1);
  }
}

void main()
{
  map<uchar, map<uchar, uchar> > Mem;
  for(int i=0; i<256; ++i)
  {
    for(int j=0; j<256; ++j)
    {
      uchar pr = i;
      uchar cur = j;
      uchar mod = i-j;
      Mem[mod][pr] = cur;
    }
  }

  string sLine;
  getline(cin, sLine);
  uchar ch, pr = 0;
  FORS(i, sLine)
  {
    ch = sLine[i];
    uchar curPr = ch;

    Mirror(ch);
    Mirror(pr);
    pr = Mem[ch][pr];
    cout << (unsigned int)pr << endl;

    pr = curPr;
  }
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <deque>

int n;
char str[119];

void ReadData()
{
  gets(str);
  //fgets(str, 110, stdin);
  n = strlen(str);
}

int reverse(int value)
{
  int result = 0;
  int cnt = 0;
  while(value != 0)
  {
    cnt++;
    result |= (value & 1);
    value >>= 1;
    result <<= 1;
  }
  while(cnt < 7)
  {
    cnt++;
    result <<= 1;
  }
  return result;
}

std::deque<int> answer;

void Solve()
{
  int prev = 0;
  for(int i = n - 1; i >= 0; i--)
  {
    int current = reverse((int)str[i]);
    int prevCurrent = i == 0 ? 0 : reverse((int)(str[i - 1]));
    int toAdd = prevCurrent - current;
    if(toAdd < 0)
    {
      toAdd += 256;
    }
    if(toAdd >= 256)
    {
      toAdd %= 256;
    }
    answer.push_front(toAdd);
  }
}

void WriteData()
{
  for(int i = 0; i < answer.size(); i++)
  {
    printf("%d\n", answer[i]);
  }
  printf("\n");
}

int main()
{
  int QWE = 1;
  #ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  scanf("%d%*c", &QWE);
  #endif
  for(int T = 0; T < QWE; T++)
  {
    ReadData();
    Solve();
    WriteData();
  }
  return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <deque>

int n;
char str[119];

void ReadData()
{
  fgets(str, 100, stdin);
  n = strlen(str);
}

int reverse(int value)
{
  int result = 0;
  int cnt = 0;
  while(value != 0)
  {
    cnt++;
    result |= (value & 1);
    value >>= 1;
    result <<= 1;
  }
  while(cnt < 7)
  {
    cnt++;
    result <<= 1;
  }
  return result;
}

std::deque<int> answer;

void Solve()
{
  int prev = 0;
  for(int i = n - 1; i >= 0; i--)
  {
    int current = reverse((int)str[i]);
    int prevCurrent = i == 0 ? 0 : reverse((int)(str[i - 1]));
    int toAdd = prevCurrent - current;
    if(toAdd < 0)
    {
      toAdd += 256;
    }
    if(toAdd >= 256)
    {
      toAdd %= 256;
    }
    answer.push_front(toAdd);
  }
}

void WriteData()
{
  for(int i = 0; i < answer.size(); i++)
  {
    printf("%d\n", answer[i]);
  }
  printf("\n");
}

int main()
{
  int QWE = 1;
  #ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  scanf("%d%*c", &QWE);
  #endif
  for(int T = 0; T < QWE; T++)
  {
    ReadData();
    Solve();
    WriteData();
  }
  return 0;
}


#include <iostream>
#include <string>
#include <cmath>

using namespace std;

int rev (int n)
{
	int res = 0;

	for (int i = 0; i < 8; i++)
	{
		res = res * 2 + n % 2;
		n /= 2;
	}

	return res;
}

int myabs (int n)
{
	if (n < 0)
		return 256 - abs(n);
	else
		return n;
}

int main()
{
	string s;
	int a[110], i, j;

	getline(cin, s);

	a[0] = 256 - rev(s[0]);

	for (i = 1; i < s.length(); i++)
		a[i] = myabs(rev(s[i-1]) - rev(s[i])) % 256;

	for (i = 0; i < s.length(); i++)
		cout << a[i] << endl;

	return 0;
}


#include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <limits.h>

using namespace std;

const int MAX_N = 4444;
const double EPS = 1e-7;
const int MOD = 256;

vector<int> v;

int mirroring(char c, int j) {
	string retranslate;
	int first;
	int len;
	int mult;
	int count;
	int ans;
	int res;

	first = (int)(c);
	retranslate = "";

	while (first > 0) {
		if (first % 2 == 0)
			retranslate = '0' + retranslate;
		else
			retranslate = '1' + retranslate;
		first /= 2;
	}
	//cout << retranslate << endl << endl;

	len = retranslate.size();

	for (int i = 0; i < 8 - len; i++)
		retranslate = '0' + retranslate;
	//cout << retranslate << endl << endl;

	//reverse(retranslate.begin(), retranslate.end());
	len = retranslate.size();

	ans = 0;
	for (int i = 0; i < len; i++) {
		if (retranslate[i] == '1') {
			mult = 1;
			count = 0;
			while (count < i) {
				mult *= 2;
				count++;
			}
			ans += mult;
		}
	}
	//cout << ans;
	//return;
	if ((v[j] - ans) >= 0)
		res = (v[j] - ans) % MOD;
	else
		res = ((v[j] - ans) % MOD + MOD) % MOD;
	v.push_back(ans);

	return res;
}

int main()
{
	string s;

	getline(cin, s);

	v.push_back(0);

	for (int i = 0; i < s.size(); i++) {
		printf("%d\n", mirroring(s[i], i));
	}

	//mirroring('e', 0);
	return 0;
}


#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <map>
#define INF 1000000000
#define ll long long
#define mod 256
using namespace std;

string s;
int ans[10000];
char c[10001];

string per(int n)
{
     string tm="";
    while (n>0)
    {
        if (n%2==0) tm+='0';
        else
        tm+='1';
        n/=2;
    }
    while (tm.length()!=8)
        tm+='0';

     return tm;
}

ll power(ll n, int k)
{
    ll tmp=1;
    for (int i=1; i<=k; i++)
        tmp=tmp*n;
     return tmp;
}

ll perevod(string s)
{
     int k=s.length()-1;
     ll ans=0;
    for (int i=0; i<s.length(); i++)
    {
        ll t=(int)(s[i]-'0');
        ll po=power(2,k);
        ans+=t*power(2,k);
        k--;
    }
        return ans;
}

int main()
{
        gets(c);
     int l=0;
     while (c[l]!=0)
     {
         s+=c[l];
         l++;
     }

      ll prev=0;
     for (int i=0; i<s.length(); i++)
     {
         int h=(int)s[i];
         string tmp=per(h);
         ll pr=perevod(tmp);
         ll tm=prev-pr;
         while (tm<0) tm+=mod;
         ans[i+1]=(tm)%mod;
         prev=pr;
     }

     for (int i=1; i<=s.length(); i++)
         cout<<ans[i]<<endl;

}


#include <iostream>
#include <fstream>
#include <conio.h>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <string>
#include <sstream>

#define FR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,c,n) for(int (i)=(c);(i)<(n);(i)++)
#define REP(it,v,cont) for(cont::iterator (it)=(v).begin();(it)!=(v).end();++(it))
#define CLR(a,c) memset((a),(c),sizeof (a))
#define ALL(v) (v).begin(),(v).end()

bool ascending (int i,int j) { return (i<j); }
bool descending (int i,int j) { return (i>j); }

typedef long long lld;

using namespace std;

char * revstr(string ch)
{
	char * ret = new char[1000];
	int len = ch.length()-1;
	for(int i = len;i>=0;i--)
		ret[i] = ch[len-i];
	ret[len+1] = '\0';
	return ret;
}

string to8(string s)
{
	string ret = s;
	while(ret.size() < 8)
		ret = "0" + ret;
	return ret;
}

string binary( unsigned long n )
  {
  char     result[ (sizeof( unsigned long ) * 8) + 1 ];
  unsigned index  = sizeof( unsigned long ) * 8;
  result[ index ] = '\0';

  do result[ --index ] = '0' + (n & 1);
  while (n >>= 1);

  return to8(string( result + index ));
  }

int doStep(int K)
{
	string s = revstr(binary(K));
	int len = s.length()-1;
	int ret = 0;
	for(int i = len;i >= 0;i--)
	{
		if(s[i] == '1')
			ret += (int)pow((double)2,(double)len-i);
	}
	return ret;
}

int Mod(int a)
{
	while(a < 0)
		a+=256;
	return a%256;
}

int main()
{
	//ifstream cin("a.in");
	//ofstream cout("a.out");
	char ch[10000];
	cin.getline(ch,10000);
	int arr[10000];
	arr[0] = 0;
	FR(i,strlen(ch))
	{
		arr[i+1] = doStep((int)ch[i]);
	}
	FR(i,strlen(ch))
		cout<<Mod(arr[i] - arr[i+1])<<endl;
}


#include <iostream>
#include <fstream>
#include <conio.h>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <string>
#include <sstream>
#include <bitset>
#include <limits>

#define FR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,c,n) for(int (i)=(c);(i)<(n);(i)++)
#define REP(it,v,cont) for(cont::iterator (it)=(v).begin();(it)!=(v).end();++(it))
#define CLR(a,c) memset((a),(c),sizeof (a))
#define ALL(v) (v).begin(),(v).end()

bool ascending (int i,int j) { return (i<j); }
bool descending (int i,int j) { return (i>j); }

typedef long long lld;

using namespace std;

char * revstr(string ch)
{
	char * ret = new char[1000];
	int len = ch.length()-1;
	for(int i = len;i>=0;i--)
		ret[i] = ch[len-i];
	ret[len+1] = '\0';
	return ret;
}

string to8(string s)
{
	string ret = s;
	while(ret.size() < 8)
		ret = "0" + ret;
	return ret;
}

string binary( unsigned long n )
  {
  char     result[ (sizeof( unsigned long ) * 8) + 1 ];
  unsigned index  = sizeof( unsigned long ) * 8;
  result[ index ] = '\0';

  do result[ --index ] = '0' + (n & 1);
  while (n >>= 1);

  return to8(string( result + index ));
  }

int doStep(int K)
{
	return bitset<numeric_limits<unsigned long>::digits>(revstr(binary(K))).to_ulong();
}

int Mod(int a)
{
	while(a < 0)
		a+=256;
	return a%256;
}

int main()
{
	//ifstream cin("a.in");
	//ofstream cout("a.out");
	char ch[10000];
	cin.getline(ch,10000);
	int arr[10000];
	arr[0] = 0;
	FR(i,strlen(ch))
	{
		arr[i+1] = doStep((int)ch[i]);
	}
	FR(i,strlen(ch))
		cout<<Mod(arr[i] - arr[i+1])<<endl;
}


#include<iostream>
#include<string>
#include<cstring>
#include<math.h>
#include<algorithm>

using namespace std;
string s,str;long long k,l,t,step,mas[101],i,j;
int main()
{
    getline(cin,s);
    k=0;
    for(i=0;i<s.length();i++)
    {
        l=(int)(s[i]);
        str="";
        t=0;
        for(j=1;j<=8;j++)
        {
            str+=(l%2+'0');
            l/=2;
        }
        step=1;
        for(j=str.length()-1;j>=0;j--)
        {
            t+=((str[j]-'0')*step);
            step*=2;
        }
        mas[i]=t;
    }
    for(i=0;i<s.length();i++)
    {
        if(!i) cout<<(256-mas[i])%256<<endl;
        else cout<<(256-(mas[i]-mas[i-1]))%256<<endl;
    }
    //cin>>s;
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <string>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

long long n, razv, pred, nov;
string s;

int main()
{
    while (cin>>n)
    {
        razv = (pred - n + 2*256)%256;
        pred = razv;
        nov = 0;
        for  (int i = 0; i < 8; i++)
            nov = nov*2 + razv%2, razv /= 2;
        cout<<char(nov);
    }
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <string>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

long long n, razv, pred, pred1, nov;
string s, s1;

int main()
{
    getline(cin, s);
    for (int i = 0;  i < s.length(); i++)
    {

        razv = s[i];
        nov = 0;
        for  (int i = 0; i < 8; i++)
            nov = nov*2 + razv%2, razv /= 2;
        pred1 = nov;
        cout<<(pred - nov+25600)%256<<endl;
        pred = pred1;
    }
    return 0;
}


#include <iostream>
#include <string>
#include <cstdio>

using namespace std;

int f(int n){
	int ans = 0;
	int d = 128;
	for (int i = 0; i < 8; i++){
		ans += d*(n % 2);
		n /= 2;
		d /= 2;
	}
	return ans;
}

int main(){
	char s[200];
	cin.getline(s,200);
	int n = strlen(s);
	int b[200];

	for (int i = 0; i < n; i++){
		b[i+1] = f(int(s[i]));
	}
	b[0] = 0;
	for (int i = 1; i <= n; i++){
		if (b[i-1] >= b[i]){
			cout << b[i-1]-b[i];
		}else{
			cout << b[i-1]-b[i]+256;
		}
		cout << '\n';
	}
	return 0;
}


    #include <cmath>
    #include <ctime>
    #include <iostream>
    #include <string>
    #include <vector>
    #include <algorithm>

    using namespace std;

	int mirror(int prev)
	{
		int result;
		int value = prev;

		int a1 = value / 128;
		value -= 128 * (value / 128);

		int a2 = value / 64;
		value -= 64 * (value / 64);

		int a3 = value /32;
		value -= 32 * (value / 32);

		int a4 = value / 16;
		value -= 16 * (value / 16);

		int a5 = value / 8;
		value -= 8 * (value / 8);

		int a6 = value / 4;
		value -= 4 * (value / 4);

		int a7 = value / 2;
		value -= 2 * (value / 2);

		int a8 = value;

		 result = 128 * a8 + 64 * a7 + 32 * a6 + 16 * a5 + 8 * a4 + 4 * a3 + 2 * a2 + a1;
		return result;
	}
     void main()
    {
		string prevP;
		string p = "";
		while (cin >> p)
		{
			for (int i = 0; i < p.size(); i++)
			{
				int prevMirror;
				if (i == 0)
				{
					if (prevP.size() > 0)
					{
						int mirrorSpace = mirror(32);
						int prevValue = (mirror(prevP[prevP.size() - 1]) - mirrorSpace) + 256;
						cout << (prevValue % 256) << endl;
						prevMirror = mirrorSpace;
					}
					else
					{
						prevMirror = 0;
					}
				}
				else
				{
					prevMirror = mirror(p[i - 1]);
				}
				int currMirror = mirror(p[i]);
				int res = ((prevMirror - currMirror) + 256) % 256;
				cout << res << endl;
			}
			prevP = p;
		}
    }


#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;

int f(int x)
{
    string s = "";
    if(x == 0)
        s = "0";
    while(x > 0)
    {
        s = char(x % 2 + '0') + s;
        x /= 2;
    }

    while(s.size() < 8)
        s = "0" + s;

    int res = 0;
    x = 1;
    for (int i = 0; i < s.size(); i++, x *= 2)
    {
        res += x * (s[i] - '0');
    }

    return res;
}

int main()
{
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    string str;
    getline(cin, str);

    int p = 0 - f(str[0]);
    if(p < 0)
        p = 256 + p;

    printf("%d\n", p);

    for (int i = 1; i < str.size(); i++)
    {
        int tmp1 = f(str[i - 1]), tmp2 = f(str[i]);
        int ans;
        if (tmp1 < tmp2)
        {
            ans = tmp1 + 256 - tmp2;
        }
        else
        {
            ans = tmp1 - tmp2;
        }

        printf("%d\n", ans);
    }

return 0;
}


#include<iostream>
#include<string>

using namespace std;

int per=0;

int func(char a);

void main(){
string a;

getline(cin,a);

for(int i=0;i<a.length();i++){
    cout<<func(a.at(i))<<"\n";
}

}

int func(char a){
    int k=int(a);
bool b[16];
int i=0,j=1;
int sum=0,sum2;

while(k>1){//Перевод в двоичную систему
b[i]=k%2;
k/=2;
i++;j++;
}
b[i]=1;

for(int i=0, i3=j;i3>-1;i3--,i++) if(b[i3]==1) sum+=1<<i;
sum2=(per-sum+256)%256;
per=sum;
return sum2;
}


#include <stdio.h>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <sstream>

#define pb push_back
#define mp make_pair
#define PI 3.14159265358979
#define forn(i, n) for(int i = 0; i < n; ++i)
#define ALL(x) x.begin(), x.end()
#define ALL(x) x.begin(), x.end()

typedef long long ll;
using namespace std;
typedef pair<int,int> pii;
const int INF = 2147483647;
const ll LLINF = 9223372036854775807LL;
int cur[8];
int mas[110];
int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
	char a[110];
	gets(a);
	int res[110]={};
	for(int i = 0;a[i]!='\0';i++)
	{
		for(int j = 0;j < 8;j++)
			cur[j] = 0;
		int j = 0;
		int n = a[i];
		while(n>1)
		{
			cur[j] = n % 2;
			j++;
			n/=2;
		}
		if(n == 0)
			cur[j] = 0;
		else
			cur[j] = 1;
		int k = 1;
		int ch = 0;
		for(int q = 7;q >= 0;q--)
		{
			if(cur[q] == 1)
			{
				ch+=k;
			}
			k*=2;
		}
		mas[i+1]=ch;
		int t = mas[i] - ch;
		if(t < 0)
			t = 256 + t;
		res[i+1] = t;
	}
	for(int i = 0;a[i]!='\0';i++)
		cout << res[i+1] << endl;
}


#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <iomanip>

using namespace std;

string s,v;
int ans, p,t;
char c;
char tr[1000];

int mypow(int k)
{
    int c = 1;
    for (int i=1; i<=k; i++)
    {
        c *= 2;
    }
    return c;
}

int main()
{
    gets(tr);
    s = (string) tr;
    p = 0;
    for (int i=0; i<s.length(); i++)
    {
        v= "";
        c = s[i];
        int k=7;
        ans = 0;
        while ((c>0)&&(k>=0))
        {
            if (c%2==1)
                ans += mypow(k);
            k--;
            c /= 2;
        }
        t = (p - ans) % 256;
        if (t<0)
            t += 256;
        cout << t << endl;
        p = ans;
    }
    return 0;
}


#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>

using namespace std;

string s,v;
int ans, p,t;
char c;

int mypow(int k)
{
    int c = 1;
    for (int i=1; i<=k; i++)
    {
        c *= 2;
    }
    return c;
}

int main()
{
    p = 0;
    while (!cin.eof())
    {
        cin >> c;
        int k=7;
        ans = 0;
        while ((c>0)&&(k>=0))
        {
            if (c%2==1)
                ans += mypow(k);
            k--;
            c /= 2;
        }
        t = (p - ans) % 256;
        if (t<0)
            t += 256;
        cout << t << endl;
        p = ans;
    }
    return 0;
}


#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
const int MAX_N = 105;

int a[MAX_N];

int relax(char ch)
{
	string our_s;
	int w = (int)ch;
	while (w > 0)
	{
		char x = char(w % 2) + '0';
		our_s += x;
		w /= 2;
	}
	int d = (int)our_s.length();
	while (d < 8) {our_s += '0'; d++;}
	int p = 1;
    d = 7;
	int ans = 0;
	while (d >= 0)
	{
		ans += (our_s[d] - '0') * p;
		p *= 2;
		d--;
	}
	return ans;
}

int main()
{
	string s;
	getline(cin, s);
	for (int i = 0; i < (int)s.length(); i++)
	{
		int x2 = relax(char(s[i]));
		int x1 = 0;
		if (i > 0) x1 = relax(char(s[i - 1]));
		int q = x1 - x2;
		if (q < 0) a[i] = 256 + q;
		else a[i] = (x1 - x2) % 256;
	}
	for (int i = 0; i < (int)s.length(); i++)
		cout << a[i] << endl;
	return 0;
}


// Codeforces_96_A.cpp : Defines the entry point for the console application.
//

//#include "stdafx.h"
#include <bitset>
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
vector<int> ans;
const int n=8;
bitset<8> my;
int f(int a,int b)
{
    int rez=1;
    if(b==0) return 1;
    while(b--)
    {
        rez=((rez*a)%1000003);
    }
    return rez;
}
void f2(int a)
{
    int k=7;
 unsigned i,j = 1 << 8-1;
  for( i=0;i<8;++i)
  {
    my[i]=((a & j) == 0 ? 0 : 1  );
    j >>= 1;
  }
}
int main()
{
    string s;
    getline(cin,s);
    int otn=0;
    int h=0;
    for(int i=0;i<s.length();i++)
    {
            f2(s[i]);
            int f=my.to_ulong();
            ans.push_back((otn-my.to_ulong())%256);
            otn=my.to_ulong();
            h++;
            my.reset();
    }
    for(int i=0;i<ans.size();i++)
    {
     cout<<ans[i]<<endl;
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;
string a;
long long answ = 0, umn = 1;
//
string dv(int x) {
	string ans = "";
	umn = 128;
	while (umn != 0) {
		if (x >= umn) {
			x-=umn;
			ans += '1';
		} else ans += '0';
		umn /= 2;
	}
	return ans;
};
//
int toint(string s) {
	umn = 128;
	int ans = 0;
	int i = 0;
	while (umn != 0) {
		if (s[i] == '1') ans += umn;
		i++;
		umn /= 2;
	}
	return ans;
}
//
int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	//
	string s = "", s1="";

	while (cin >> s1) {
		s+= s1+" ";
	}
	s = s.substr(0, s.size() - 1);
	int last = 0;
	//
	for (int i = 0; i < s.size(); i++) {
		string s1 = dv((int)s[i]);
		reverse(s1.begin(), s1.end());
		int x = toint(s1);
		cout << (last - x + 256) % 256 << endl;

		last = x;
	}
	//
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;
string a;
long long answ = 0, umn = 1;
//
string dv(int x) {
	string ans = "";
	umn = 128;
	while (umn != 0) {
		if (x >= umn) {
			x-=umn;
			ans += '1';
		} else ans += '0';
		umn /= 2;
	}
	return ans;
};
//
int toint(string s) {
	umn = 128;
	int ans = 0;
	int i = 0;
	while (umn != 0) {
		if (s[i] == '1') ans += umn;
		i++;
		umn /= 2;
	}
	return ans;
}
//
int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	//
	string s = "", s1="";

	while (cin >> s1) {
		s+= s1;
	}
	int last = 0;
	//
	for (int i = 0; i < s.size(); i++) {
		string s1 = dv((int)s[i]);
		reverse(s1.begin(), s1.end());
		int x = toint(s1);
		cout << (last - x + 256) % 256 << endl;

		last = x;
	}
	//
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;
string a;
long long answ = 0, umn = 1;
//
string dv(int x) {
	string ans = "";
	umn = 128;
	while (umn != 0) {
		if (x >= umn) {
			x-=umn;
			ans += '1';
		} else ans += '0';
		umn /= 2;
	}
	return ans;
};
//
int toint(string s) {
	umn = 128;
	int ans = 0;
	int i = 0;
	while (umn != 0) {
		if (s[i] == '1') ans += umn;
		i++;
		umn /= 2;
	}
	return ans;
}
//
int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	//
	string s = "", s1="";

	while (cin >> s1) {
		s+= s1+" ";
	}
	int last = 0;
	//
	for (int i = 0; i < s.size(); i++) {
		string s1 = dv((int)s[i]);
		reverse(s1.begin(), s1.end());
		int x = toint(s1);
		cout << (last - x + 256) % 256 << endl;

		last = x;
	}
	//
}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef vector< int > VI;
typedef vector< string > VS;
typedef pair< int, int > II;
typedef long long LL;
#define FOR(i,b,e) for(int (i)=(int)(b);(i)<(int)(e);++(i))
#define FORIT(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define INF 987654321

unsigned char reverse(unsigned char x)
{
    unsigned char y = 0;
    FOR(i, 0, 8)
        if (x & (1<<i)) y |= 1<<(7-i);
    return y;
}

int main()
{
    string s;
    char buf[111];
    cin.getline(buf, 111);
    s = string(buf);
    int n = (int)s.size();
    FOR(i, 0, n) {
        unsigned char p = i == 0 ? 0 : reverse(s[i-1]);
        unsigned char y = s[i];
        unsigned char tmp = reverse(y);
        int a = int(p)-int(tmp);
        if (a < 0) a += 256;
        cout << a << endl;
    }
    return 0;
}


#include <algorithm>
#include <numeric>
#include <string>
#include <string.h>
#include <iostream>
#include <fstream>
#include <cmath>
#include <math.h>
#include <iomanip>
#include <stdlib.h>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <stack>

using namespace std;
#define FOR(i,n) for (int i=0; i<n; ++i)
#define FORE(i,n) for (int i=0; i<=n; ++i)
#define REP(i,a,b) for (int i=a; i<b; ++i)
#define REPE(i,a,b) for (int i=a; i<=b; ++i)
#define ALL(c) (c).begin(), (c).end()
#define DEC(i,n) for(int i=n-1;i>=0;i--)
#define SORT(c) sort(ALL(c))
#define pb push_back
#define mp make_pair
#define pb push_back
typedef pair<int, int> PII;

typedef vector<PII> VPII;
typedef long long int LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<bool> VB;
const double pi = acos(-1.0);
const int INF =(int) 1e9;
int mirror(int x)
{
	int res = 0;
	FOR(i,8)
	{
		res<<=1;
		res+=x&1;
		x>>=1;
	}

	return res;
}
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	LL n,d;
	int c;
	string s;
	getline(cin,s);
	VI rev(s.size()+1);
	rev[0] = 0;
	FOR(i,s.size())
	{
		rev[i+1] =mirror( s[i]);

	}
	FOR(i,s.size())
	{
		cout<<(rev[i]-rev[i+1] + 256) %256<<endl;
	}
	return 0;
}


                                        /* in the name of Allah */
#include <iostream>
#include <memory.h>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <cstdio>
#include <string>
#include <vector>
#include <queue>
#include <map>

using namespace std;

#define int64 long long
#define P pair<int, int>

int rev(int x){
    int ret = 0;
    for(int i = 0; i < 8; i++){
        ret = ret * 2 + x % 2;
        x /= 2;
    }
    return ret;
}

int main(){
    string str;
    getline(cin, str);
    int bef = 0;
    for(int i = 0; i < str.length(); i++){
        int t1 = (i == 0 ? 0 : rev((int)str[i - 1]));
        int t2 = rev((int)str[i]);
        cout << (t1 - t2 + 256) % 256 << endl;
    }
    return 0;
}


#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace::std;

#define MOD 256

int binToDec(int a[])
{
	int sum = 0;
	int multi = 1;
	for (int i = 0; i < 8; i++)
	{
		sum += a[i] * multi;
		multi *= 2;
	}
	return sum;
}

int main()
{
	int bin[8] = { 0 };
	int rbin[8] = { 0 };
	string s;
	cin >> s;

	int first = 1;
	int lastCharacter = 0;
	int thisCharacter = 0;
	int multi, a, ans;
	for (int i = 0; i < s.length(); i++)
	{
		multi = pow(2, 7);
		a = static_cast<int>(s.at(i));
		for (int i = 0; i < 8; i++)
		{
			bin[7 - i] = a / multi;
			rbin[i] = bin[7 - i];
			a -= bin[7 - i] * multi;
			multi /= 2;
		}

		thisCharacter = binToDec(rbin);
		ans = lastCharacter - thisCharacter;
		if (ans < 0)
		{
			ans += MOD;
		}
		lastCharacter = thisCharacter;
		cout << ans << endl;
	}
    return 0;
}


#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace::std;

#define MOD 256

int binToDec(int a[])
{
	int sum = 0;
	int multi = 1;
	for (int i = 0; i < 8; i++)
	{
		sum += a[i] * multi;
		multi *= 2;
	}
	return sum;
}

int main()
{
	int bin[8] = { 0 };
	int rbin[8] = { 0 };
	string s;
	getline(cin, s);

	int first = 1;
	int lastCharacter = 0;
	int thisCharacter = 0;
	int multi, a, ans;
	for (int i = 0; i < s.length(); i++)
	{
		multi = pow(static_cast<float>(2), 7);
		a = static_cast<int>(s.at(i));
		for (int j = 0; j < 8; j++)
		{
			bin[7 - j] = a / multi;
			rbin[j] = bin[7 - j];
			a -= bin[7 - j] * multi;
			multi /= 2;
		}

		thisCharacter = binToDec(rbin);
		ans = lastCharacter - thisCharacter;
		if (ans < 0)
		{
			ans += MOD;
		}
		lastCharacter = thisCharacter;
		cout << ans << endl;
	}
    return 0;
}


#include <iostream>
#include <math.h>
#include <Windows.h>
#include <algorithm>
#include <string.h>
typedef unsigned char uch;
using namespace std;

uch ch[10001];
uch a[10001];
int i,j,k;
uch inv(uch c)
{
     uch a = 0;
     a = a | (((bool)(c & 1)) << 7);
     a = a | (((bool)(c & 2)) << 6);
     a = a | (((bool)(c & 4)) << 5);
     a = a | (((bool)(c & 8)) << 4);
     a = a | (((bool)(c & 16)) << 3);
     a = a | (((bool)(c & 32)) << 2);
     a = a | (((bool)(c & 64)) << 1);
     a = a | (((bool)(c & 128)) << 0);
     return a;
}

int main()
{
    int i = 1;
    while (ch[i-1] != '\n')
    {
          ch[i] = getchar();
          i++;
    }

    for (j = 1; j < i - 1; j++)
    {
        a[j] = inv(ch[j - 1]) - inv(ch[j]);
        cout << (int)a[j] << endl;
    }

   //getchar();
   //getchar();
   return 0;
}


#include <iostream>
using namespace std;

typedef unsigned char byte;

byte rev(char b)
{
  b = (b & 0x55) << 1 | (b & 0xAA) >> 1;
  b = (b & 0x33) << 2 | (b & 0xCC) >> 2;
  return (b & 0x0F) << 4 | (b & 0xF0) >> 4;
}

void main()
{
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  char s[101];
  gets(s);
  int n = strlen(s);
  printf("%d\n", (byte)-rev(s[0]));
  for(int i = 1; i < n; i++)
    printf("%d\n", (byte)(rev(s[i - 1]) - rev(s[i])));
}


#include<iostream>
#include<string>
#include<vector>
#include<cmath>
int mod(int a){
    if (a >= 0)
        return a % 256;
    return 256 + a % 256;
}
int BitReverse(int a){
    std::string s;
    while (a){
        s += char(a % 2 + '0');
        a /= 2;
    }
    int len = s.length(),res=0;
    while (len < 8){
        s += '0';
        len++;
    }
    for (int i = 1; i <= 8; i++)
        res += (int(s[i-1]-'0')*int(pow(2.0, double(len - i))));
    return res;
}
int main(){
    std::string s;
    getline(std::cin, s);
    std::vector<int>v;
    v.push_back(mod(-BitReverse(s[0])));
    int len = s.length();
    for (int i = 1; i<len; i++)
        v.push_back(mod(BitReverse(s[i-1])-BitReverse(s[i])));
    int sz = v.size();
    for (int i = 0; i<sz; i++)
        std::cout << v[i] << '\n';
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <complex>

using namespace std;

#define file "file"
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;

const int MAXN = 5e5 + 5;
const double EPS = 1e-9;
const ll INF = 1000000000000 + 5;
const int MAXN2 = 1e4 + 5;

char s[MAXN];
int a[MAXN];

int main()
{
	//freopen(file".in","r",stdin); freopen(file".out","w",stdout);
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	gets(s+1);

	s[0] = '!';
	int n = strlen(s);
	a[0] = 0;
	int c1,c2,c3;
	c3 = 0;
	for(int i=1;i<n;i++)
	{
		c2 = 0;
		c1 = s[i];
		for(int j=0;j<8;j++)
		{
			if(c1&(1<<j)) c2 |= (1<<(7 - j));
		}

		a[i] = (c3 - c2 + 256)%256;
		c3 = c2;
	}

	for(int i=1;i<n;i++) printf("%d\n",a[i]);
	return 0;
}


#include <stdio.h>
#include <iostream>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <complex>

using namespace std;

#define file "file"
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;

const int MAXN = 5e5 + 5;
const double EPS = 1e-9;
const ll INF = 1000000000000 + 5;
const int MAXN2 = 1e4 + 5;

char s[MAXN];
int a[MAXN];

int main()
{
	//freopen(file".in","r",stdin); freopen(file".out","w",stdout);
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	gets(s+1);

	int n = strlen(s);
	a[0] = 0;
	int c1,c2,c3;
	c3 = 0;
	for(int i=1;i<n;i++)
	{
		c2 = 0;
		c1 = s[i];
		for(int j=0;j<8;j++)
		{
			if(c1&(1<<j)) c2 |= (1<<(7 - j));
		}

		a[i] = (c3 - c2 + 256)%256;
		c3 = c2;
	}

	for(int i=1;i<n;i++) printf("%d\n",a[i]);
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <string>
#include <string.h>
#include <math.h>
#include <stdlib.h>

using namespace std;

#define REP(i,n) for (int i=0, _n=(n)-1; i <= _n; i++)
#define REPD(i,n) for (int i=(n)-1; i >= 0; i--)
#define FOR(i,a,b) for (int i=(a), _b=(b); i <=_b; i++)
#define FORD(i,a,b) for (int i=(a), _b=(b); i >=_b; i--)
#define X first
#define Y second

template < class T > T sqr (T a) { return (a) * (a); }
template < class T > T abs (T a) { return (a < 0) ? -(a) : (a); }

const double Pi = acos(-1.0);
const double eps = 1e-20;
const int INF = 101e7;

int two[40]={ 1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824};

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif

    /*char ftp[260];
    scanf("%s",&ftp);
    string s=string(ftp);

    REP(i,10)
        bin[i]=0;*/

    bool bin[10];
    int before=0,ans=0;
    string s="";
    char ch;
    //scanf("%c",&ch);
    while ( scanf("%c",&ch)>0 ) {
        if (ch!='\n')s+=ch;

    }

//    cin.get(stdin,s);
    REP(i,s.size()) {
        REP(k,10)
            bin[k]=0;

        int tmp=s[i];
        int j=1;
        while (tmp>0) {
            bin[j]=tmp%2;
            tmp/=2;
            j++;
        }

        ans=0;
        FOR(z,1,8)
            ans=2*ans+bin[z];

        printf("%d\n",(before-ans) % 256 + 256*(before<ans));

        before=ans;

    }

    return 0;
}


#include <stdlib.h>
#include <time.h>
#include <vector>
#include <math.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <fstream>
#include <string>
#include <stack>
#include <utility>
#include <map>
#include <set>
#include <queue>

using namespace std;

const int M=10+10;
typedef long long int ll;

int REV(int x)
{
	vector<int> tmp;
	for (int i=0; i<8; i++)
	{
		int num=(x>>i) &1;
		tmp.push_back(num);
	}
	int num=0;
	for (int i=0; i<tmp.size(); i++)
	{
		num=(num*2+tmp[i]);
	}
	return num;
}

int main()
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);

	string s;
	getline(cin,s);

	int len=s.length();

	int num=0;

	for (int i=0; i<len; i++)
	{
		int rev1=REV(num);
		int rev2=REV(s[i]);
		int ans=rev1-rev2;
		if (ans<0)
		{
			ans+=256;
		}
		else
		{
			ans=ans%256;
		}
		cout<<ans<<endl;
		num=s[i];
	}

	return 0;

}


#include <stdlib.h>
#include <time.h>
#include <vector>
#include <math.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <fstream>
#include <string>
#include <stack>
#include <utility>
#include <map>
#include <set>
#include <queue>

using namespace std;

const int M=10+10;
typedef long long int ll;

int REV(int x)
{
	vector<int> tmp;
	for (int i=0; i<8; i++)
	{
		int num=(x>>i) &1;
		tmp.push_back(num);
	}
	int num=0;
	for (int i=0; i<tmp.size(); i++)
	{
		num=(num*2+tmp[i]);
	}
	return num;
}

int main()
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);

	string s;
	cin>>s;

	int len=s.length();

	int num=0;

	for (int i=0; i<len; i++)
	{
		int rev1=REV(num);
		int rev2=REV(s[i]);
		int ans=rev1-rev2;
		if (ans<0)
		{
			ans+=256;
		}
		else
		{
			ans=ans%256;
		}
		cout<<ans<<endl;
		num=s[i];
	}

	return 0;

}


#include <memory.h>
#include <stdio.h>
#include <assert.h>

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <string>
#include <queue>
#include <cmath>

using namespace std;

#define all(x) (x).begin(), (x).end()
#define FOR(i, b, e) for (int i = (b); i < (e); ++i)
#define RE(i, n) FOR (i, 0, n)
#define MP(x, y) make_pair((x), (y))

int main() {
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
#endif
    string str;
    while (cin >> str) {
        int pre = 0;
        for (int i = 0; i < str.size(); ++i) {
            int res = 0;
            for (int j = 0; j < 8; ++j) {
                if (str[i] & (1 << j)) {
                    res |= (1 << 7 - j);
                }
            }
            int tmp = res%256;
            res = (pre - res + 256) % 256;
            pre = tmp;
            cout << res << endl;
        }
    }
    return 0;
}


#include <memory.h>
#include <stdio.h>
#include <assert.h>

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <string>
#include <queue>
#include <cmath>

using namespace std;

#define all(x) (x).begin(), (x).end()
#define FOR(i, b, e) for (int i = (b); i < (e); ++i)
#define RE(i, n) FOR (i, 0, n)
#define MP(x, y) make_pair((x), (y))

int main() {
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
#endif
    string str;
    while (cin >> str) {
        int pre = 0;
        for (int i = 0; i < str.size(); ++i) {
            int res = 0;
            for (int j = 0; j < 8; ++j) {
                if (str[i] & (1 << j)) {
                    res |= (1 << 7 - j);
                }
            }
            int tmp = res;
            res = pre - res;
            res = (256 + res)%256;
            pre = tmp;
            cout << res << endl;
        }
    }
    return 0;
}


#include <memory.h>
#include <stdio.h>
#include <assert.h>

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <string>
#include <queue>
#include <cmath>

using namespace std;

#define all(x) (x).begin(), (x).end()
#define FOR(i, b, e) for (int i = (b); i < (e); ++i)
#define RE(i, n) FOR (i, 0, n)
#define MP(x, y) make_pair((x), (y))

int main() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
#endif
	char str[110];
	while (cin.getline(str, 110)) {
		int len = strlen(str);
		int pre = 0;
		for (int i = 0; i < len; ++i) {
			int res = 0;
			for (int j = 0; j < 8; ++j) {
				if (str[i] & (1 << j)) {
					res |= (1 << 7 - j);
				}
			}
			int tmp = res%256;
			res = (pre - res + 256) % 256;
			pre = tmp;
			cout << res << endl;
		}
	}
	return 0;
}


#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <tuple>
#include <map>
#include <set>

#pragma comment(

using namespace std;

#define ll long long
#define loop( i, b, e ) for ( auto i = b; i != e; i++ )
#define mt make_tuple
#define mp make_pair

unsigned char conv( unsigned char a )
{
	unsigned char m = 0;

	for ( int j = 0; j < 8; j++ )
	{
		m = m << 1;
		m |= ( a & 1 );
		a = a >> 1;
	}

	return m;
}

void program()
{
	string s;

	getline( cin, s );

	unsigned char last = 0;

	for ( ll i = 0; i < s.length(); i++ )
	{
		unsigned char m = conv( s[i] );

		unsigned char m1 = last - m;

		cout << m1 % 256 << "\n";

		last = m;
	}

	return;
}

//=====================================================

int main()
{
	cin.sync_with_stdio( false );
	cout.sync_with_stdio( false );

	bool first = true;

	while ( cin && !cin.eof() )
	{
		if ( first )
			first = false;
		else
			cout << endl << endl;

		program();

		cin >> ws;
	}

	return 0;
}


#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <string>
#include <set>
#include <vector>
using namespace std;
int a[101];
int step[10]={1,2,4,8,16,32,64,128,256,512};
long long revers(long long c)
{
	long long d=0;
	int i;
	for(i=0;i<8;i++)
		if((c/step[i])%2==1)
			d|=step[7-i];
	return d;
}
int main()
{
	long long j,h,t,i=0,s=0,mod=1000003;
	char e;
	while(scanf("%c",&e)!=EOF&&e!='\n')
	{
		if(i==0)
		{
			h=e;
			t=e;
			t=revers(t);
			a[i]=(256-t)%256;
		}
		else
		{
			h=revers(h);
			t=e;
			t=revers(t);
			a[i]=(h-t+256)%256;
			h=e;
		}
		i++;
	}
	for(j=0;j<i;j++)
	{
		cout<<a[j];
		if(j+1!=i)
			cout<<'\n';
	}

	return 0;
}


#include <iostream>
#include <string>
#include <cmath>
using namespace std;
int a[10];
string s;
int main()
{
    getline(cin,s);
    int j,q=0,v,l=s.length(),o,u,k,w;
    for(int i=0;i<l;i++)
    {
        u=1;
        w=8;
        j=0;
        u=128;
        while(w>0)
        {
            a[j]=s[i]/u;
            if(u<=s[i])
                s[i]-=u;
            j++;
            w--;
            u/=2;
        }
        k=1;
        o=0;
        u=0;
        for(int p=0;p<j;p++)
        {
            k=a[p];
            for(int h=0;h<u;h++)
                k=k*2;
            o+=k;
            u++;
        }
        v=q;
        q=o;
        o=v-o;
        if(o<0)
            cout<<256-((o*-1)%256)<<endl;
        else
            cout<<o%256<<endl;
    }
    return 0;
}


#include <cstdio>
#include <iostream>
#include <map>

using namespace std;

int f(unsigned char n)
{
    int s = 0;
    for (int i = 0; i < 8; i++) {
        if (n & (1 << i)) {
            s |= 1 << (7 - i);
        }
    }

    return s;
}

int main()
{
    char str[200];

    gets(str);

    int pre;
    for (int i = 0; str[i]; i++) {
        if (i == 0)
            pre = 0;
        int ans = f((unsigned)str[i]);
        if (pre - ans < 0) {
            cout << 256 + pre - ans << endl;
        } else {
            cout << (pre - ans) % 256 << endl;
        }
        pre = ans;
    }

    return 0;
}


#include <cstdio>
#include <iostream>
#include <map>

using namespace std;

int f(unsigned char n)
{
	int s = 0;
	for (int i = 0; i < 8; i++) {
		if (n & (1 << i)) {
			s |= 1 << (7 - i);
		}
	}

	return s;
}

int main()
{
	char str[200];

	cin >> str;

	int pre;
	for (int i = 0; str[i]; i++) {
		if (i == 0)
			pre = 0;
		int ans = f((unsigned)str[i]);
		if (pre - ans < 0) {
			cout << 256 + pre - ans << endl;
		} else {
			cout << (pre - ans) % 256 << endl;
		}
		pre = ans;
	}

	return 0;
}


#include <stdio.h>
#include <stdlib.h>

#define _USE_MATH_DEFINES

#include <math.h>
#include <limits.h>

#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <iterator>
#include <numeric>
#include <functional>
#include <algorithm>
#include <utility>

#include <stdio.h>
#include <stdlib.h>

#define _USE_MATH_DEFINES

#include <math.h>
#include <limits.h>

#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <iterator>
#include <numeric>
#include <functional>
#include <algorithm>
#include <utility>

int reverse(int value) {
	int result = 0;
	for(unsigned int i = 0; i < 8; i++) {
		result <<= 1;
		result += (value&1);
		value >>= 1;
	}
	return result;
}

int main() {
	char in[101];
	::gets(in);
	int prev = 0;
	for(unsigned int i = 0; i < ::strlen(in); i++) {
		const int revValue = reverse(in[i]);
		const unsigned result = (256 - (revValue - prev)) % 256;
		prev = revValue;
		::printf("%d\n", result);
	}
	return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

int main()
{
    string input = "";
    getline(cin, input);
    int a1 = 0, a2;
    for(int i=0;i<input.size();i++)
    {
        unsigned char reverseChar = 0;
        for(int j=0;j<8;j++)
            reverseChar |= ((input[i] & (1 << j))>0?1:0) << (7-j);
        cout << (a1-reverseChar+256)%256 << endl;
        a1 = reverseChar;
    }
}


#include<iostream>
#include<iomanip>
#include<string>
using namespace std;
int getv(char a)
{   int v=int(a);
    int t=0;
	for(int i=0;i<8;i++)
		if(v&1<<i) t+=1<<(7-i);

	return t;
}
int main()
{    string s;
    for(;cin>>s;)
	{   int fa=0;
	     fa=0-getv(s[0]);

		 if(fa<0) fa+=256;
		   fa=fa%256;
		   cout<<fa<<endl;
	    for(int i=1;i<s.length ();i++)
		{   fa=getv(s[i-1])-getv(s[i]);
		   if(fa<0) fa+=256;
		   fa=fa%256;
		   cout<<fa<<endl;

		}

	}
}


#include<iostream>
#include<iomanip>
#include<string>
using namespace std;
int getv(char a)
{   int v=int(a);
    int t=0;
	for(int i=0;i<8;i++)
		if(v&1<<i) t+=1<<(7-i);

	return t;
}
int main()
{    string s;
    for(;cin>>s;)
	{   int fa=0;
	     fa=0-getv(s[0]);

		 if(fa<0) fa+=256;
		   fa=fa%256;
		   cout<<fa<<endl;
	    for(int i=1;i<s.length ();i++)
		{   fa=getv(s[i-1])-getv(s[i]);
		   if(fa<0) fa+=256*10;
		   fa=fa%256;
		   cout<<fa<<endl;

		}

	}
}


#include<iostream>
#include<iomanip>
#include<string>
using namespace std;
int getv(char a)
{   int v=int(a);
    int t=0;
	for(int i=0;i<8;i++)
		if(v&1<<i) t+=1<<(7-i);

	return t;
}
int main()
{    string s;
    for(;getline(cin,s);)
	{   int fa=0;
	     fa=0-getv(s[0]);

		 if(fa<0) fa+=256;
		   fa=fa%256;
		   cout<<fa<<endl;
	    for(int i=1;i<s.length ();i++)
		{   fa=getv(s[i-1])-getv(s[i]);
		   if(fa<0) fa+=256*10;
		   fa=fa%256;
		   cout<<fa<<endl;

		}

	}
}


#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string>
using namespace std;

int get(int xt)
{
	int ans=0;
	for(int i=0;i<8;i++)
	{
		ans*=2;
		ans+=xt%2;
		xt/=2;
	}
	return ans;
}

int main()
{
	char a[110]="";
	gets(a);
	int len=strlen(a);
	int xt=0;
	for(int i=0;i<len;i++)
	{
		int tmp=a[i];
		tmp=get(tmp);
		if(i!=len) cout<<(xt-tmp+256)%256<<endl;
		else cout<<(xt-tmp+256)%256;
		xt=tmp;
		//cout<<"  xt=="<<xt<<endl;
	}
	return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string>
using namespace std;

int get(int xt)
{
	int ans=0;
	for(int i=0;i<8;i++)
	{
		ans*=2;
		ans+=xt%2;
		xt/=2;
	}
	return ans;
}

int main()
{
	char a[110]="";
	cin>>a;
	int len=strlen(a);
	int xt=0;
	for(int i=0;i<len;i++)
	{
		int tmp=a[i];
		tmp=get(tmp);
		if(i!=len) cout<<(xt-tmp+256)%256<<endl;
		else cout<<(xt-tmp+256)%256;
		xt=tmp;
	}
	return 0;
}


#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>

using namespace std;

string s, s1;
int b[10], z, ch, previous;

int main()
{
	/*freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);*/
	previous = 0;
	int sch = 1;
	while (cin >> s1)
	{
		if (sch > 1)
			s = s + " " + s1; else s += s1;
		sch++;
	}
	for (int i = 0; i < s.length(); i++)
	{
		int k = s[i];
		z = 0;
		while (k)
		{
			b[z] = k % 2;
			k = k / 2;
			z++;
		}
		int mn = 1;
		ch = 0;
		for (int j = 7; j > -1; j--)
		{
			ch += b[j] * mn;
			mn *= 2;
		}
		if (previous - ch > 0)
			cout << (previous - ch) % 256 << endl; else
			cout << (256 + previous - ch) % 256 << endl;
		previous = ch;
	}
	return 0;
}


#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>

using namespace std;

string s, s1;
int b[10], z, ch, previous, c[10];

int main()
{
	/*freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);*/
	previous = 0;
	int sch = 1;
	while (cin >> s1)
	{
		if (sch > 1)
			s = s + " " + s1; else s += s1;
		sch++;
	}
	for (int i = 0; i < s.length(); i++)
	{
		int k = s[i];
		z = 0;
		for (int j = 0; j < 10; j++)
			b[j] = 0;
		while (k)
		{
			b[z] = k % 2;
			k = k / 2;
			z++;
		}
		int mn = 1;
		ch = 0;
		for (int j = 7; j > -1; j--)
		{
			ch += b[j] * mn;
			mn *= 2;
		}
		if (previous - ch > 0)
			cout << (previous - ch) % 256 << endl; else
			cout << (256 + previous - ch) % 256 << endl;
		previous = ch;
	}
	return 0;
}


#pragma warning (disable : 4996)
#pragma comment(linker, "/STACK:16777216")
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <string.h>
#include <memory.h>
#include <queue>
#include <algorithm>
using namespace std;
const int inf = 1000 * 1000 * 1000;
const double eps = 1e-10;
typedef long long LL;
#define vint vector<int>
#define vvint vector<vint>

int pow(int a, int b)
{
	if (b == 0)
		return 1;
	if (b == 1)
		return a;
	if (b & 1)
		return a * pow(a, b-1);
	else
	{
		int temp = pow(a, b/2);
		return temp*temp;
	}
}
int symbol(char ch)
{
	int k = ch;
	int ar[8];
	for (int i = 0; i < 8; i++)
	{
		ar[i] = k % 2;
		k /= 2;
	}
	k = 0;
	for (int i = 7; i >= 0; i--)
	{
		k += (ar[i] * pow(2, 7-i));
	}
	return k;
}
int main()
{
	char s[132];
	gets(s);
	int res = 0;
	int L = (int)strlen(s);
	for (int i = 0; i < L; i++)
	{
		int t = symbol(s[i]);
		int u = (256 + res - t)%256;
		printf("%d\n", u);
		res = t;
	}
	return 0;
}


//this problem is solved by pol

#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

unsigned int f(unsigned int u)
{
unsigned int v=0;
for(int i=0;i<8;i++)
   {
   v=v<<1;
   if(u&01) v++;
   //cout<<"!"<<u<<" "<<v<<endl;
   u=u>>1;
   }
return v;
}

int main () {

//unsigned int a=(0-18)%256;
//cout<<a%256<<endl;

string text; getline(cin,text);
unsigned int pred=0, d;

for(int i=0;i<text.length();i++)
//for(int i=0;i<1;i++)
   {
   //cout<<"!"<<f(int(text[i]))<<endl;
   d=pred-f(int(text[i]));
   cout<<d%256<<endl;
   pred=f(int(text[i]));

   }

  return 0;
}


#define _CRT_SECURE_NO_DEPRECATE
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <ctime>
#include <cmath>
#include <sstream>
#include <numeric>

#pragma comment(linker, "/STACK:64000000")

#define sz(x) (int)(x).size()
#define all(x) (x).begin(),(x).end()
#define EPS 1e-9
#define INF INT_MAX
#define sqr(X) (X) * (X)
#define round(x) (int)((x) + 0.5 + EPS)

using namespace std;

typedef unsigned int uint;
typedef unsigned long long ull;
typedef long long int64;

typedef pair <int, int> pii;
typedef vector <int> vi;
typedef vector <vi> vvi;
typedef vector <uint> vu;
typedef vector <ull> vull;
typedef vector <pii> vpii;
typedef vector <vpii> vvpii;
typedef vector <string> vs;

#define TASK "test"

int rev(int x)
{
    int curPow = 1 << 7;
    int res = 0;
    while (x)
    {
        if (x & 1) res += curPow;
        curPow >>= 1;
        x >>= 1;
    }
    return res;
}

int main()
{
#ifndef ONLINE_JUDGE
    freopen(TASK ".in", "r", stdin);
    freopen(TASK ".out", "w", stdout);
#endif

    char s[200];
    gets(s);
    int prev = 0;
    for (int i = 0; s[i]; i++)
    {
        int val = rev(s[i]);
        cout << (prev - val + 256) % 256 << endl;
        prev = val;
    }

    return 0;
}


#define _CRT_SECURE_NO_DEPRECATE
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <ctime>
#include <cmath>
#include <sstream>
#include <numeric>

#pragma comment(linker, "/STACK:64000000")

#define sz(x) (int)(x).size()
#define all(x) (x).begin(),(x).end()
#define EPS 1e-9
#define INF INT_MAX
#define sqr(X) (X) * (X)
#define round(x) (int)((x) + 0.5 + EPS)

using namespace std;

typedef unsigned int uint;
typedef unsigned long long ull;
typedef long long int64;

typedef pair <int, int> pii;
typedef vector <int> vi;
typedef vector <vi> vvi;
typedef vector <uint> vu;
typedef vector <ull> vull;
typedef vector <pii> vpii;
typedef vector <vpii> vvpii;
typedef vector <string> vs;

#define TASK "test"

int rev(int x)
{
    int curPow = 1 << 7;
    int res = 0;
    while (x)
    {
        if (x & 1) res += curPow;
        curPow >>= 1;
        x >>= 1;
    }
    return res;
}

int main()
{
#ifndef ONLINE_JUDGE
    freopen(TASK ".in", "r", stdin);
    freopen(TASK ".out", "w", stdout);
#endif

    char s[200];
    gets(s);
    int prev = 0;
    for (int i = 0; i < s[i]; i++)
    {
        int nVal = rev(s[i]);
        nVal = (prev + 256 - nVal) % 256;
        printf("%d\n", nVal);
        prev = rev(s[i]);
    }

    return 0;
}


#define _CRT_SECURE_NO_DEPRECATE
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <ctime>
#include <cmath>
#include <sstream>
#include <numeric>

#pragma comment(linker, "/STACK:64000000")

#define sz(x) (int)(x).size()
#define all(x) (x).begin(),(x).end()
#define EPS 1e-9
#define INF INT_MAX
#define sqr(X) (X) * (X)
#define round(x) (int)((x) + 0.5 + EPS)

using namespace std;

typedef unsigned int uint;
typedef unsigned long long ull;
typedef long long int64;

typedef pair <int, int> pii;
typedef vector <int> vi;
typedef vector <vi> vvi;
typedef vector <uint> vu;
typedef vector <ull> vull;
typedef vector <pii> vpii;
typedef vector <vpii> vvpii;
typedef vector <string> vs;

#define TASK "test"

int rev(int x)
{
    int curPow = 1 << 7;
    int res = 0;
    while (x)
    {
        if (x & 1) res += curPow;
        curPow >>= 1;
        x >>= 1;
    }
    return res;
}

int main()
{
#ifndef ONLINE_JUDGE
    freopen(TASK ".in", "r", stdin);
    freopen(TASK ".out", "w", stdout);
#endif

    char s[200];
    gets(s);
    int prev = 0;
    for (int i = 0; i < s[i]; i++)
    {
        int val = rev(s[i]);
        int num = (prev - val + 1024) % 256;
        cout << num << endl;
        prev = val;
    }

    return 0;
}


#define _CRT_SECURE_NO_DEPRECATE
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <ctime>
#include <cmath>
#include <sstream>
#include <numeric>

#pragma comment(linker, "/STACK:64000000")

#define sz(x) (int)(x).size()
#define all(x) (x).begin(),(x).end()
#define EPS 1e-9
#define INF INT_MAX
#define sqr(X) (X) * (X)
#define round(x) (int)((x) + 0.5 + EPS)

using namespace std;

typedef unsigned int uint;
typedef unsigned long long ull;
typedef long long int64;

typedef pair <int, int> pii;
typedef vector <int> vi;
typedef vector <vi> vvi;
typedef vector <uint> vu;
typedef vector <ull> vull;
typedef vector <pii> vpii;
typedef vector <vpii> vvpii;
typedef vector <string> vs;

#define TASK "test"

int rev(int x)
{
    int curPow = 1 << 7;
    int res = 0;
    while (x)
    {
        if (x & 1) res += curPow;
        curPow >>= 1;
        x >>= 1;
    }
    return res;
}

int main()
{
#ifndef ONLINE_JUDGE
    freopen(TASK ".in", "r", stdin);
    freopen(TASK ".out", "w", stdout);
#endif

    char s[200];
    gets(s);
    int prev = 0;
    for (int i = 0; i < s[i]; i++)
    {
        int val = rev(s[i]);
        int num = (prev - val + 256) % 256;
        cout << num << endl;
        prev = val;
    }

    return 0;
}


#include <stdio.h>
#include <vector>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;

#define pii pair<int,int>
#define ppii pair<pii,pii>
#define int64 long long

#define MAGIC 42
#define SQR(x) ((x) * (x))

#define li vector<int>

#define TASK
#define ONLINE_JUDJE

vector <int> dd;
int n;

int sd(int a)
{
    vector <int> b;
    while(a)
    {
        b.push_back(a % 2);
        a /= 2;
    }
    while(b.size() < 8)
        b.push_back(0);
    int res = 0;
    int  s = 1;
    for (int i = b.size() - 1; i >= 0; i--)
    {
        if (b[i])
            res += s;
        s *= 2;
    }
    return res;
}

int main()
{
/*#ifndef ONLINE_JUDJE
    freopen(TASK".in","r", stdin);
    freopen(TASK".out","w", stdout);
#endif*/
    char s[120];
    char s2;
    s[1] ='d';
    bool f = true;
    int st = 0;
    memset(s, 0, sizeof(s));
    while(true)
    {
        scanf("%c", &s2);
        if (s2 < 32)
            break;
        s[strlen(s)] = s2;

    }
    n = strlen(s);
    int prev = 0;
    for (int i = 0; i < n; i++)
    {
        int ss = s[i];
        int t = 0 - sd(s[i]);
        if (i > 0)
            t = sd(s[i - 1]) - sd(s[i]);
        if (t < 0)
            prev = 256 + t;
        else
            prev = t %256;
        printf("%d\n", prev);
    }
    return 0;
}


// Author : Muhammad Rifayat Samee
// Problem : C
// Algorithm:
#pragma warning (disable : 4786)
#pragma comment(linker, "/STACK:16777216")

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cctype>
#include<cstring>
#include<algorithm>
#include<string>
#include<set>
#include<vector>
#include<map>
#include<queue>
#include<stack>
#define MAX(a,b) (a>b)?a:b
#define MIN(a,b) (a<b)?a:b
#define INF 987654321
#define pi (2*acos(0.0))
#define eps 1e-7

#ifdef ONLINE_JUDGE
#define i64 long long
#else
#define i64 __int64
#endif

using namespace std;
char str[105];
int n,len;
int modit(int p){
	int res = 1;
	int i;
	for(i=0;i<p;i++){
		res = res * 2;
	}
	return res;
}

int rev(int a){
	int i,j,res = 1,r;
	char str[10];
	i = 0;
	while(a!=0){
		r = a%2;
		str[i] = r + '0';
		i++;
		a = a / 2;
	}
	str[i] = NULL;

	if(strlen(str)<8){
		len = strlen(str);
		for(i=len;i<=7;i++){
			str[i] = '0';

		}
		str[i] = NULL;
		//str[i] = '0';
		//str[i+1] = NULL;
	}
	j = strlen(str)-1;
	res = 0;
	for(i=0;str[i];i++,j--){
		if(str[i]=='1')
			res = res + modit(j);
	}
	return res;
}
int main(){

	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	int i,j,k,prev,cur,res;
	while(gets(str)){
		prev = 0;
		for(i=0;str[i];i++){
			cur = rev(str[i]);
			res = (prev-cur+256)%256;
			//res = rev(res);
			printf("%d\n",res);
			prev = cur;
		}
	}
	return 0;
}


#include <iostream>
#include <string>
#include <map>
using namespace std;

char str[400];

int rev(int v)
{
	int ans = 0;
	for(int i=0,j=7;i<=7;i++,j--)
		if((v & 1<<j))
			ans |= 1<<i;
	return ans;
}

void tobin(int v)
{
	for(int i=7;i>=0;i--)
		if((v & 1<<i))
			cout<<1;
		else
			cout<<0;
	cout<<endl;
}

int main()
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);

	cin.getline(str,150);
	int sz = strlen(str);

	for(int i=0;i<sz;i++)
	{
		int t1 = rev(str[i]);
		int t2 = rev((i-1>=0 ? str[i-1] : 0));
		cout<<(t2-t1+256)%256<<endl;
	}
	return 0;
}


#include<iostream>
#include<string>
#include<string.h>
#include<math.h>
#include<vector>
#include<algorithm>
using namespace std;
string s;
int i,n,k,sum,t,j,c,x[1000],b[1000];
vector <int> a;
int main()
{
	getline(cin,s);
	for(i=0;i<s.length();i++)
	{
		a.clear();
		k=(int)s[i];
		t=128;
		for(j=0;j<8;j++)
		{
			a.push_back(k/t);
			k%=t;
			t/=2;
		}
		reverse(a.begin(),a.end());
		t=128;
		for(j=0;j<a.size();j++)
			b[i]+=a[j]*t,t/=2;
	}
	for(i=0;i<s.length();i++)
		cout<<(b[i-1]-b[i]+256)%256<<endl;
	return 0;
}


#include "iostream"
#include "string"

#define long long int64;

using namespace std;

pair <int, int> change (int a, int last) {
	string tmp;
	int arg = a;
	while (arg > 0) {
		if (arg % 2 == 1) tmp += '1'; else tmp += '0';
		arg /= 2;
	}
	while (tmp.length() < 8) tmp += '0';
	int counter = 1;
	int ret = 0;
	for (int i = tmp.length() - 1; i >= 0; i--) {
		if (tmp[i] == '1') ret += counter;
		counter *= 2;
	}
	a = ret;
	ret = last - ret;
	while (ret < 0)
		ret += 256;
	while (ret >= 256)
		ret -= 256;
	return make_pair(ret, a);
}

int main (){
	//freopen ("input.txt", "r", stdin);
	//freopen ("output.txt", "w", stdout);
	string s;
	getline (cin, s);
	int temp = 0;
	for (int i = 0; i < s.length(); i++) {
		cout << change (s[i], temp).first << endl;
		temp = change (s[i], temp).second;
	}
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include <string.h>
int arr[8];
int bindec(int num)
{
    int i,tmp,pt=1;
    for(i=0;i<8;i++)
        arr[i]=0;
    i=7;
    while(num!=1)
    {
        arr[i]=num%2;
        num/=2;
        i--;
    }
    arr[i]=num;

    for(i=0;i<4;i++)
    {
        tmp=arr[i];
        arr[i]=arr[7-i];
        arr[7-i]=tmp;
    }
    num=0;
    for(i=7;i>=0;i--){
        num+=arr[i]*pt;
        pt*=2;
    }
    return num;
}
int main()
{
    char str[110];
    int l,i=0,num,lnum=0;
    //freopen("fin.txt","r",stdin);
    while(scanf("%c",&str[i])!=-1) i++;
    l=i-1;
    for(i=0;i<l;i++){
        num=bindec((int)str[i]);
        if(i!=0)
        {
            lnum=bindec((int)str[i-1]);
            num=(lnum-num);
        }
        else num=(0-num);
        if(num>=0) num%=256;
        else num+=256;
        printf("%d\n",num);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <memory.h>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>

using namespace std;

#define X first
#define Y second
#define pb push_back
#define mp make_pair
#define ppb pop_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<pii> vii;
typedef vector<vi> vvi;
typedef vector<vb> vvb;

vi toB(ll a) {
  vi res;
  while(a > 0) {
    res.pb(a%2);
    a /= 2;
  }
  while(sz(res) < 8)
    res.pb(0);
  reverse(all(res));
  return res;
}

ll toInt(vi &a) {
  ll res = 0;
  for(int i = 0; i < sz(a); i++) {
    res = (res + a[i]*(1 << i))%256;
  }
  return res;
}

int main() {
  string s;
  getline(cin, s);
  ll res = 0;
  for(int i = 0; i < sz(s); i++) {
    vi tmp = toB(int(s[i]));
    ll t = toInt(tmp);
    ll p = t;
    t = (256 + res - t)%256;
    res = p;
    cout << t << endl;
  }
  return 0;
}


#include<iostream>
using namespace std;
int main()
{
	char str[109];
	int temp,len,i,t,l,j,k,q;
	int stack[100];

	while(gets(str)!=NULL)
	{
		len=strlen(str);
		temp=0;

		for(i=0;i<len;i++)
		{
			l=0;
			t=str[i];
			memset(stack,0,sizeof(stack));
			while(t)
			{
				stack[l++]=t%2;
				t/=2;
			}
            q=1;
			k=0;

			for(j=7;j>=0;j--)
			{
				k+=stack[j]*q;
				q*=2;
			}

            int ans=temp-k;
            if(ans<0)
			{
				ans=256+ans;
			}
			printf("%d\n",ans%256);
			temp=k;

		}

	}
	return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#pragma warning (disable:4996)

int main(void)
{
    char str[101];
    char a,t;

    int rez[101];
    int len,i,prev=0,j,x,b;

    gets(str);
    len=strlen(str);

    prev=0;
    a=str[0];
    b=0;
    for (j=0;j<8;j++)
        {
            t=1<<j;
            if (a&(1 << j))
                b+=(1 << (7-j));
        }
    x=(prev-b+256);
    rez[0]=x;
    prev=b;
    for (i=1;i<len;i++)
    {
        a=str[i];
        b=0;
        for (j=0;j<8;j++)
        {
            t=1<<j;
            if (a&(1 << j))
                b+=(1 << (7-j));
        }
        rez[i]=(prev-b+256)%256;
        prev=b;
    }
    for (i=0;i<len;i++)
        printf("%d\n",rez[i]);

    return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <stdio.h>
using namespace std;
long long div2(int v)
{
    long long a = 2;
    long long r = 1;
    while(v)
    {
        if(v % 2 == 0)
        {
            v /= 2;
            a *= a;
        }
        else
        {
            v--;
            r *= a;
        }
    }
    return r;
}
int git(unsigned char ch)
{
    string r;
    for (int i = 0; i < 8; i++)
    {
        r += ch % 2 + '0';
        ch /= 2;
    }
    int res = 0;
    for (int i = 0; i < 8; i++)
    {
        if(r[7 - i] == '1')
            res += div2(i);
    }
    return res;
}

int main()
{
    //freopen ("intput.txt","r",stdin);
    char c;
    string s;
    int p = 0;
    while(scanf("%c",&c) != EOF)
    {
        if(c >= ' ' && c <= '~')
        {
            int d;
            d = git(c);
            int r  = (p - d + 256 * 2) % 256;
            printf ("%d\n",r);
            p = d;
        }
    }
    cin.unget();
    return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <stdio.h>
using namespace std;
long long div2(int v)
{
    long long a = 2;
    long long r = 1;
    while(v)
    {
        if(v % 2 == 0)
        {
            v /= 2;
            a *= a;
        }
        else
        {
            v--;
            r *= a;
        }
    }
    return r;
}
int git(char ch)
{
    string r;
    for (int i = 0; i < 8; i++)
    {
        r += ch % 2 + '0';
        ch /= 2;
    }
    int res = 0;
    for (int i = 0; i < 8; i++)
    {
        if(r[7 - i] == '1')
            res += div2(i);
    }
    return res;
}

int main()
{
    //freopen ("intput.txt","r",stdin);
    char c;
    string s;
    int p = 0;
    while(scanf("%c",&c) != EOF)
    {
        int d;
        d = git(c);
        int r  = (p - d + 256 * 2) % 256;
        printf ("%d\n",r);
        p = d;
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <stdio.h>
using namespace std;
long long div2(int v)
{
    long long a = 2;
    long long r = 1;
    while(v)
    {
        if(v % 2 == 0)
        {
            v /= 2;
            a *= a;
        }
        else
        {
            v--;
            r *= a;
        }
    }
    return r;
}
int git(unsigned char ch)
{
    string r;
    for (int i = 0; i < 8; i++)
    {
        r += ch % 2 + '0';
        ch /= 2;
    }
    int res = 0;
    for (int i = 0; i < 8; i++)
    {
        if(r[7 - i] == '1')
            res += div2(i);
    }
    return res;
}

int main()
{
    //freopen ("intput.txt","r",stdin);
    char c;
    string s;
    int p = 0;
    while(scanf("%c",&c) != EOF)
    {
        int d;
        d = git(c);
        int r  = (p - d + 256 * 2) % 256;
        printf ("%d\n",r);
        p = d;
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <stdio.h>
using namespace std;
long long div2(int v)
{
    long long a = 2;
    long long r = 1;
    while(v)
    {
        if(v % 2 == 0)
        {
            v /= 2;
            a *= a;
        }
        else
        {
            v--;
            r *= a;
        }
    }
    return r;
}
int git(unsigned char ch)
{
    string r;
    for (int i = 0; i < 8; i++)
    {
        r += ch % 2 + '0';
        ch /= 2;
    }
    int res = 0;
    for (int i = 0; i < 8; i++)
    {
        if(r[7 - i] == '1')
            res += div2(i);
    }
    return res;
}

int main()
{
    //freopen ("intput.txt","r",stdin);
    char c;
    string s;
    int p = 0;
    while(scanf("%c",&c) != EOF)
    {
        int d;
        d = git(c);
        int r  = (p - d + 256 * 2) % 256;
        printf ("%d\n",r);
        p = d;
    }
    cin.unget();
    return 0;
}


#include <iostream>
#include <string>
using namespace std;

long long pow(long long a, int b) {
    long long result = a;
    for (int i = 0; i < b-1; i++)
        result *= a;
    return result;
}

long long bin_to_dec (string str) {
    long long result = 0;
    int c = str.size();
    for (int i = 0; i < str.size(); i++) {
        c--;
        if (str[i] == '1')
            result += pow(2, c);
    }
    return result;
}

string dec_to_bin (long long k) {
    string result = "";

    while(k > 1) {
        int tmp = k % 2;
        switch(tmp) {
            case 0:
                result = '0' + result;
                break;
            case 1:
                result = '1' + result;
        }
        k = k / 2;
    }
    switch(k) {
        case 0:
            result = '0' + result;
            break;
        case 1:
            result = '1' + result;
    }

    while(result.size() < 8)
        result = '0' + result;
    return result;
}

int main (int argc, char *argv[])
{
    string str = "", tmp;
    cin >> tmp;
    str += tmp;
    while(cin >> tmp)
        str += " " + tmp;

    int p[105];
    p[0] = 0;
    for (int i = 1; i <= str.size(); i++) {
        string bin = dec_to_bin(str[i-1]), bin2 = "";
        for (int j = bin.size() - 1; j >= 0; j--)
            bin2 += bin[j];

        p[i] = bin_to_dec(bin2);

        int k = p[i-1] - p[i];
        if (k < 0)
            k = 256+k;

        cout << k << endl;
    }

    return 0;
}


#include <iostream>
#include <string>
using namespace std;

long long pow(long long a, int b) {
    long long result = a;
    for (int i = 0; i < b-1; i++)
        result *= a;
    return result;
}

long long bin_to_dec (string str) {
    long long result = 0;
    int c = str.size();
    for (int i = 0; i < str.size(); i++) {
        c--;
        if (str[i] == '1')
            result += pow(2, c);
    }
    return result;
}

string dec_to_bin (long long k) {
    string result = "";

    while(k > 1) {
        int tmp = k % 2;
        switch(tmp) {
            case 0:
                result = '0' + result;
                break;
            case 1:
                result = '1' + result;
        }
        k = k / 2;
    }
    switch(k) {
        case 0:
            result = '0' + result;
            break;
        case 1:
            result = '1' + result;
    }

    while(result.size() < 8)
        result = '0' + result;
    return result;
}

int main (int argc, char *argv[])
{
    string str = "", tmp;
    while(cin >> tmp)
        str += tmp;

    int p[105];
    p[0] = 0;
    for (int i = 1; i <= str.size(); i++) {
        string bin = dec_to_bin(str[i-1]), bin2 = "";
        for (int j = bin.size() - 1; j >= 0; j--)
            bin2 += bin[j];

        p[i] = bin_to_dec(bin2);

        int k = p[i-1] - p[i];
        if (k < 0)
            k = 256+k;

        cout << k << endl;
    }

    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<cmath>
#define INF 999999999
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MID(a,b) ((a+b)>>1)
using namespace std;
char str[1010];
int a[1010];
int cnt;
int pre=0;
int main(){
    gets(str);
    for(int i=0;i<strlen(str);i++){
        cnt=0;
        for(int j=0;j<8;j++){
            a[j]=0;
        }
        while(str[i]){
            a[cnt]=str[i]%2;
            str[i]/=2;
            cnt++;
        }
        for(int j=0;j<4;j++){
            a[j]^=a[7-j];
            a[7-j]^=a[j];
            a[j]^=a[7-j];
        }
        int ans=0;
        for(int j=7;j>=0;j--){
            //printf("%d",a[j]);
            ans=ans*2+a[j];
        }
        //printf("\n");

        int tmp=pre;
        pre=ans;
        ans=(tmp-ans+256)%256;
        printf("%d\n",ans);
        str[i]='f';
    }
}


#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>

#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <string>

using namespace std;

#define fr first
#define sc second
#define mp make_pair
#define all(a) a.begin(), a.end()

typedef long long int64;

const int INF = (int) 1e9;
const int64 INF64 = (int64) 1e18;
const long double EPS = 1e-9;
const long double PI = 3.14159265358979323846;

int main() {
    //freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
    string s;
    getline(cin, s);
    int prev = 0;
    for (int i = 0; i < s.size(); i++) {
        int x = s[i];
        vector<int> a;
        for (int j = 0; j < 8; j++) {
            a.push_back(x & 1);
            x >>= 1;
        }
        x = 0;
        for (int j = 0; j < 8; j++) {
            x <<= 1;
            x += a[j];
        }
        int cur;
        cur = (prev - x) % 256;
		if (cur < 0) {
			cur += 256;
		}
        printf("%d\n", cur);
        a.clear();
		prev = x;
    }
    return 0;
}


/*
accepted
*/

#include<stdio.h>
#include<string.h>
#include<math.h>
#define max 103

#define mod 256

char a[max];

int rev(int a)
{
	int n=0,i;

	for(i=7;i>=0;i--)
	{
		if(a&1) n+=pow(2,i);

		a/=2;
	}

	return n;
}

int main()
{
	int i,l,pre,n;

	gets(a);
	l = strlen(a);

	pre=0;

	for(i=0;i<l;i++)
	{
		//pre = (rev(pre) - rev(a[i])+mod)%mod;
		n = (rev(pre) - rev(a[i])+mod)%mod;

		printf("%d\n",n);
		pre = a[i];
	}

	return 0;
}


/*
accepted
*/

#include<stdio.h>
#include<string.h>
#include<math.h>
#define max 103

#define mod 256

char a[max];

int poww[9];

int rev(int a)
{
    int n=0,i;

    for(i=7;i>=0;i--)
    {
        if(a&1)
        {
            n+=poww[i];
        }

        a/=2;
    }

    return n;
}

int main()
{
    int i,l,pre,n;

    poww[0]=1;
    for(i=1;i<8;i++) poww[i] = poww[i-1]*2;

    gets(a);
    l = strlen(a);

    pre=0;

    for(i=0;i<l;i++)
    {
        //pre = (rev(pre) - rev(a[i])+mod)%mod;
        n = (rev(pre) - rev(a[i])+mod)%mod;

        printf("%d\n",n);
        pre = a[i];
    }

    return 0;
}


#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <vector>
#include <bitset>
#include <stdio.h>
#include <queue>

using namespace std;
char s[1005];

string f (int x) {
    string res;
    while (x) {
        res = (char)((x % 2) + '0') + res;
        x /= 2;
    }
    while (res.size() < 8)
        res = '0' + res;
    return res;
}

int to (string s) {
    int res = 0;
    int pow = 1;
    for (int i = (int)s.size() - 1; i >= 0; --i) {
        if (s[i] == '1')
            res += pow;
        pow *= 2;
    }
    return res;
}
int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    gets(s);

    int n = strlen(s);
    int prev = 0;
    for (int i = 0; i < n; ++i) {
        string cur = f((int)s[i]);
        reverse(cur.begin(), cur.end());
        int x = to(cur);
        int y = (((prev - x) % 256) + 256) % 256;
        cout << y << endl;
        prev = x;
    }
    return 0;
}


#include <cstdio>
#include <cstring>

int main()
{
	char s[200];
	gets(s);
	int pred = 0,a[8],mir = 0;
	unsigned short int ans[200];
	for (int i = 0;i < strlen(s);i++)
	{
		int tmp = (unsigned)s[i],j = 7;
		for (int t = 0;t < 8;t++)
			a[t] = 0;
		while (tmp > 0)
		{
			a[j--] = tmp % 2;
			tmp /= 2;
		}
		int pow = 1;
		mir = 0;
		for (j = 0;j < 8;j++)
		{
			mir += pow*a[j];
 			pow *= 2;
		}

		ans[i] = (unsigned)(pred-mir) % 256;

		pred = mir;
	}
	for (int i = 0;i < strlen(s);i++)
		printf("%d\n",ans[i]);
	getchar();getchar();
	return 0;
}


#include<iostream>
#include<vector>
#include<unordered_map>
#include<queue>
#include<cmath>
#include<bitset>
#include<algorithm>
#include<cstring>
#include<utility>
#include<map>
#include<set>
#include<stack>
#include<unordered_set>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define repeat(n) for(int _=0;_<n;_++)
#define arrInp(a,n) loop(i,0,n) cin>>a[i]
#define all(v) v.begin(),v.end()
#define memset(a,v) memset(a,v,sizeof(a));
#define mod int(1e9+7)
#define MAX int(1e5)
#define pb push_back
#define um unordered_map
#define mp make_pair
#define us unordered_set
#define fastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

// Codeforces - Substring - #460 div-2 D

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;

vvi g;
bitset<MAX> visited;
int m[5][1000];
int dp[1000];

ll min(ll a,ll b) {

	return a < b ? a : b;
}

void dfs(int u) {

	visited[u] = true;

	for(int v : g[u]) {
		if(!visited[v])
			dfs(v);
		dp[u] = max(dp[u],dp[v]);
	}

	dp[u]++;
}

bool isBefore(int *a,int n,int x,int y) {

	int idx;

	loop(i,0,n) {
		if(a[i]==x || a[i]==y) {
			idx = i;
			break;
		}
	}

	return a[idx]==x;
}

void solve(int n,int k) {

	g.assign(n,vi());

	loop(i,1,n) {
		loop(j,i+1,n+1) {
			bool ins = true;
			loop(x,0,k) {
				if(!isBefore(m[x],n,i,j)) {
					ins = false;
					break;
				}
			}
			if(ins)
				g[i-1].pb(j-1);
		}
	}

	// loop(u,0,n) {
	// 	cout<<u+1<<" : ";
	// 	for(int v : g[u])
	// 		cout<<v+1<<" ";
	// 	cout<<"\n";
	// }

	int ans = 0;

	loop(u,0,n) {
		if(!visited[u])
			dfs(u);
		ans = max(ans,dp[u]);
	}

	cout<<ans<<"\n";
}

int main() {

	fastIO

	int n,k;
	// int u,v;
	cin>>n>>k;

	loop(i,0,k)
		loop(j,0,n)
			cin>>m[i][j];

	//g.assign(n,vi());

	// loop(i,0,m) {
	// 	cin>>u>>v;
	// 	u-- , v--;
	// 	g[u].pb(v);
	// }

	solve(n,k);
}


#include<iostream>
#include<vector>
#include<unordered_map>
#include<queue>
#include<cmath>
#include<bitset>
#include<algorithm>
#include<cstring>
#include<utility>
#include<map>
#include<set>
#include<stack>
#include<unordered_set>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define repeat(n) for(int _=0;_<n;_++)
#define arrInp(a,n) loop(i,0,n) cin>>a[i]
#define all(v) v.begin(),v.end()
#define memset(a,v) memset(a,v,sizeof(a));
#define mod int(1e9+7)
#define MAX int(1e5)
#define pb push_back
#define um unordered_map
#define mp make_pair
#define us unordered_set
#define fastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

// Codeforces - Substring - #460 div-2 D

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;

vvi g;
bitset<MAX> visited;
int m[6][1001];
int pos[6][1001];
int dp[1001];

// we have to use dp array since
// 6 2
// 4 3 1 2 5 6
// 1 4 3 2 5 6

ll min(ll a,ll b) {

	return a < b ? a : b;
}

void solve(int n,int k) {

	int ans = 0;
	memset(dp,0);

	// loop(u,1,n+1) {
	// 	loop(v,0,u) {
	// 		bool take = true;
	// 		loop(x,1,k+1) {
	// 			int a = m[x][u] , b = m[x][v];
	// 			if(pos[x][a] < pos[x][b]) {
	// 				take = false;
	// 				break;
	// 			}
	// 		}
	// 		if(take)
	// 			dp[u] = max(dp[u],dp[v]+1);
	// 	}
	// 	ans = max(ans,dp[u]);
	// }

	for(int i=1;i<=n;i++){
		for(int j=0;j<i;j++){
			bool g=0;
			for(int l=1;l<=k;l++)if (pos[l][m[1][i]]<pos[l][m[1][j]])g=1;
			if (g)continue;
			dp[i]=max(dp[i],dp[j]+1);
		}
		ans=max(ans,dp[i]);
	}

	cout<<ans<<"\n";
}

int main() {

	fastIO

	int n,k,inp;
	cin>>n>>k;

	loop(i,1,k+1) {
		loop(j,1,n+1) {
			cin>>inp;
			m[i][j] = inp;
			pos[i][inp] = j;
		}
	}

	solve(n,k);
}


#include<iostream>
#include<vector>
#include<unordered_map>
#include<queue>
#include<cmath>
#include<bitset>
#include<algorithm>
#include<cstring>
#include<utility>
#include<map>
#include<set>
#include<stack>
#include<unordered_set>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define repeat(n) for(int _=0;_<n;_++)
#define arrInp(a,n) loop(i,0,n) cin>>a[i]
#define all(v) v.begin(),v.end()
#define memset(a,v) memset(a,v,sizeof(a));
#define mod int(1e9+7)
#define MAX int(1e5)
#define pb push_back
#define um unordered_map
#define mp make_pair
#define us unordered_set
#define fastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

// Codeforces - Substring - #460 div-2 D

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;

vvi g;
bitset<MAX> visited;
int m[5][1000];
int pos[5][1000];
int dp[1000];

// we have to use dp array since
// 6 2
// 4 3 1 2 5 6
// 1 4 3 2 5 6

ll min(ll a,ll b) {

	return a < b ? a : b;
}

void solve(int n,int k) {

	int ans = 0;

	loop(u,0,n) {
		loop(v,0,u) {
			bool take = true;
			loop(w,0,k) {
				int a = m[w][u] , b = m[w][v];
				if(pos[w][a] > pos[w][b]) {
					take = false;
					break;
				}
			}
			if(take==false)
				continue;
			dp[u] = max(dp[u],dp[v]+1);
		}
		ans = max(ans,dp[u]);
	}

	cout<<ans<<"\n";
}

int main() {

	fastIO

	int n,k,inp;
	cin>>n>>k;

	loop(i,0,k) {
		loop(j,0,n) {
			cin>>inp;
			m[i][j] = inp-1;
			pos[i][inp-1] = j;
		}
	}

	solve(n,k);
}


#include<iostream>
#include<vector>
#include<unordered_map>
#include<queue>
#include<cmath>
#include<bitset>
#include<algorithm>
#include<cstring>
#include<utility>
#include<map>
#include<set>
#include<stack>
#include<unordered_set>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define repeat(n) for(int _=0;_<n;_++)
#define arrInp(a,n) loop(i,0,n) cin>>a[i]
#define all(v) v.begin(),v.end()
#define memset(a,v) memset(a,v,sizeof(a));
#define mod int(1e9+7)
#define MAX int(1e5)
#define pb push_back
#define um unordered_map
#define mp make_pair
#define us unordered_set
#define fastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

// Codeforces - Substring - #460 div-2 D

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;

vvi g;
bitset<MAX> visited;
int m[5][1000];
int dp[1000];

// we have to use dp array since
// 6 2
// 4 3 1 2 5 6
// 1 4 3 2 5 6

ll min(ll a,ll b) {

	return a < b ? a : b;
}

void dfs(int u) {

	visited[u] = true;

	for(int v : g[u]) {
		if(!visited[v])
			dfs(v);
		dp[u] = max(dp[u],dp[v]);
	}

	dp[u]++;
}

void solve(int n,int k) {

	g.assign(n,vi());

	loop(i,0,n) {
		loop(j,0,n) {
			if(i==j)
				continue;
			bool ins = true;
			loop(x,0,k) {
				if(m[x][i] > m[x][j]) {
					ins = false;
					break;
				}
			}
			if(ins)
				g[i].pb(j);
		}
	}

	// loop(u,0,n) {
	// 	cout<<u+1<<" : ";
	// 	for(int v : g[u])
	// 		cout<<v+1<<" ";
	// 	cout<<"\n";
	// }

	int ans = 0;

	loop(u,0,n) {
		if(!visited[u])
			dfs(u);
		ans = max(ans,dp[u]);
	}

	cout<<ans<<"\n";
}

int main() {

	fastIO

	int n,k,inp;
	// int u,v;
	cin>>n>>k;

	loop(i,0,k) {
		loop(j,0,n) {
			cin>>inp;
			m[i][inp-1] = j;
		}
	}

	//g.assign(n,vi());

	// loop(i,0,m) {
	// 	cin>>u>>v;
	// 	u-- , v--;
	// 	g[u].pb(v);
	// }

	solve(n,k);
}


#include<iostream>
#include<vector>
#include<unordered_map>
#include<queue>
#include<cmath>
#include<bitset>
#include<algorithm>
#include<cstring>
#include<utility>
#include<map>
#include<set>
#include<stack>
#include<unordered_set>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define repeat(n) for(int _=0;_<n;_++)
#define arrInp(a,n) loop(i,0,n) cin>>a[i]
#define all(v) v.begin(),v.end()
#define memset(a,v) memset(a,v,sizeof(a));
#define mod int(1e9+7)
#define MAX int(1e5)
#define pb push_back
#define um unordered_map
#define mp make_pair
#define us unordered_set
#define fastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

// Codeforces - Substring - #460 div-2 D

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;

// vvi g;
// bitset<MAX> visited;
int m[5][1000];
int pos[5][1000];
int dp[1000];

ll min(ll a,ll b) {

	return a < b ? a : b;
}

void solve(int n,int k) {

	int ans = 0;

	loop(x,0,n) {
		dp[x] = 1;
		loop(y,0,x) {
			bool take = true;
			loop(z,1,k) {
				int a = m[0][x] , b = m[0][y];
				if(pos[z][a] < pos[z][b]) {
					take = false;
					break;
				}
			}
			if(take)
				dp[x] = max(dp[x],dp[y]+1);
		}
		ans = max(ans,dp[x]);
	}

	cout<<ans<<"\n";
}

int main() {

	fastIO

	int n,k,inp;
	cin>>n>>k;

	loop(i,0,k) {
		loop(j,0,n) {
			cin>>inp;
			m[i][j] = inp-1;
			pos[i][inp-1] = j;
		}
	}

	solve(n,k);
}


#include<iostream>
#include<vector>
#include<unordered_map>
#include<queue>
#include<cmath>
#include<bitset>
#include<algorithm>
#include<cstring>
#include<utility>
#include<map>
#include<set>
#include<stack>
#include<unordered_set>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define repeat(n) for(int _=0;_<n;_++)
#define arrInp(a,n) loop(i,0,n) cin>>a[i]
#define all(v) v.begin(),v.end()
#define memset(a,v) memset(a,v,sizeof(a));
#define mod int(1e9+7)
#define MAX int(1e5)
#define pb push_back
#define um unordered_map
#define mp make_pair
#define us unordered_set
#define fastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

// Codeforces - Substring - #460 div-2 D

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;

vvi g;
bitset<MAX> visited;
int m[5][1000];
int pos[5][1000];
int dp[1000];

// we have to use dp array since
// 6 2
// 4 3 1 2 5 6
// 1 4 3 2 5 6

ll min(ll a,ll b) {

	return a < b ? a : b;
}

void solve(int n,int k) {

	int ans = 0;

	loop(u,0,n) {
		loop(v,0,n) {
			bool take = true;
			loop(x,0,k) {
				int a = m[x][u] , b = m[x][v];
				if(pos[x][a] < pos[x][b]) {
					take = false;
					break;
				}
			}
			if(take)
				dp[u] = max(dp[u],dp[v]+1);
		}
		ans = max(ans,dp[u]);
	}

	cout<<ans<<"\n";
}

int main() {

	fastIO

	int n,k,inp;
	cin>>n>>k;

	loop(i,0,k) {
		loop(j,0,n) {
			cin>>inp;
			m[i][j] = inp-1;
			pos[i][inp-1] = j;
		}
	}

	solve(n,k);
}


#include<iostream>
#include<vector>
#include<unordered_map>
#include<queue>
#include<cmath>
#include<bitset>
#include<algorithm>
#include<cstring>
#include<utility>
#include<map>
#include<set>
#include<stack>
#include<unordered_set>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define repeat(n) for(int _=0;_<n;_++)
#define arrInp(a,n) loop(i,0,n) cin>>a[i]
#define all(v) v.begin(),v.end()
#define memset(a,v) memset(a,v,sizeof(a));
#define mod int(1e9+7)
#define MAX int(1e5)
#define pb push_back
#define um unordered_map
#define mp make_pair
#define us unordered_set
#define fastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

// Codeforces - Substring - #460 div-2 D

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;

vvi g;
bitset<MAX> visited;
int m[5][1000];
int dp[1000];

ll min(ll a,ll b) {

	return a < b ? a : b;
}

int dfs(int u) {

	visited[u] = true;
	int ans = 0;

	for(int v : g[u]) {
		if(!visited[v])
			ans = max(ans,dfs(v));
		//dp[u] = max(dp[u],dp[v]);
	}

	//dp[u]++;
	return ++ans;
}

bool isBefore(int *a,int n,int x,int y) {

	int idx;

	loop(i,0,n) {
		if(a[i]==x || a[i]==y) {
			idx = i;
			break;
		}
	}

	return a[idx]==x;
}

void solve(int n,int k) {

	g.assign(n,vi());

	loop(i,1,n+1) {
		loop(j,1,n+1) {
			if(i==j)
				continue;
			bool ins = true;
			loop(x,0,k) {
				if(!isBefore(m[x],n,i,j)) {
					ins = false;
					break;
				}
			}
			if(ins)
				g[i-1].pb(j-1);
		}
	}

	// loop(u,0,n) {
	// 	cout<<u+1<<" : ";
	// 	for(int v : g[u])
	// 		cout<<v+1<<" ";
	// 	cout<<"\n";
	// }

	int ans = 0;

	loop(u,0,n) {
		if(!visited[u])
			ans = max(ans,dfs(u));
		//ans = max(ans,dp[u]);
	}

	cout<<ans<<"\n";
}

int main() {

	fastIO

	int n,k;
	// int u,v;
	cin>>n>>k;

	loop(i,0,k)
		loop(j,0,n)
			cin>>m[i][j];

	//g.assign(n,vi());

	// loop(i,0,m) {
	// 	cin>>u>>v;
	// 	u-- , v--;
	// 	g[u].pb(v);
	// }

	solve(n,k);
}


#include<iostream>
#include<vector>
#include<unordered_map>
#include<queue>
#include<cmath>
#include<bitset>
#include<algorithm>
#include<cstring>
#include<utility>
#include<map>
#include<set>
#include<stack>
#include<unordered_set>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define repeat(n) for(int _=0;_<n;_++)
#define arrInp(a,n) loop(i,0,n) cin>>a[i]
#define all(v) v.begin(),v.end()
#define memset(a,v) memset(a,v,sizeof(a));
#define mod int(1e9+7)
#define MAX int(1e5)
#define pb push_back
#define um unordered_map
#define mp make_pair
#define us unordered_set
#define fastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

// Codeforces - Substring - #460 div-2 D

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;

vvi g;
bitset<MAX> visited;
int m[5][1000];
int dp[1000];

ll min(ll a,ll b) {

	return a < b ? a : b;
}

void dfs(int u) {

	visited[u] = true;

	for(int v : g[u]) {
		if(!visited[v])
			dfs(v);
		dp[u] = max(dp[u],dp[v]);
	}

	dp[u]++;
}

bool isBefore(int *a,int n,int x,int y) {

	int idx;

	loop(i,0,n) {
		if(a[i]==x || a[i]==y) {
			idx = i;
			break;
		}
	}

	return a[idx]==x;
}

void solve(int n,int k) {

	g.assign(n,vi());

	loop(i,1,n+1) {
		loop(j,1,n+1) {
			if(i==j)
				continue;
			bool ins = true;
			loop(x,0,k) {
				if(!isBefore(m[x],n,i,j)) {
					ins = false;
					break;
				}
			}
			if(ins)
				g[i-1].pb(j-1);
		}
	}

	// loop(u,0,n) {
	// 	cout<<u+1<<" : ";
	// 	for(int v : g[u])
	// 		cout<<v+1<<" ";
	// 	cout<<"\n";
	// }

	int ans = 0;

	loop(u,0,n) {
		if(!visited[u])
			dfs(u);
		ans = max(ans,dp[u]);
	}

	cout<<ans<<"\n";
}

int main() {

	fastIO

	int n,k;
	// int u,v;
	cin>>n>>k;

	loop(i,0,k)
		loop(j,0,n)
			cin>>m[i][j];

	//g.assign(n,vi());

	// loop(i,0,m) {
	// 	cin>>u>>v;
	// 	u-- , v--;
	// 	g[u].pb(v);
	// }

	solve(n,k);
}


#include<iostream>
#include<vector>
#include<unordered_map>
#include<queue>
#include<cmath>
#include<bitset>
#include<algorithm>
#include<cstring>
#include<utility>
#include<map>
#include<set>
#include<stack>
#include<unordered_set>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define repeat(n) for(int _=0;_<n;_++)
#define arrInp(a,n) loop(i,0,n) cin>>a[i]
#define all(v) v.begin(),v.end()
#define memset(a,v) memset(a,v,sizeof(a));
#define mod int(1e9+7)
#define MAX int(1e5)
#define pb push_back
#define um unordered_map
#define mp make_pair
#define us unordered_set
#define fastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

// Codeforces - Substring - #460 div-2 D

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;

vvi g;
bitset<MAX> visited;
int m[5][1000];
int pos[5][1000];
int dp[1000];

// we have to use dp array since
// 6 2
// 4 3 1 2 5 6
// 1 4 3 2 5 6

ll min(ll a,ll b) {

	return a < b ? a : b;
}

void solve(int n,int k) {

	int ans = 0;

	loop(u,0,n) {
		loop(v,0,u) {
			bool take = true;
			loop(x,0,k) {
				int a = m[x][u] , b = m[x][v];
				if(pos[x][a] < pos[x][b]) {
					take = false;
					break;
				}
			}
			if(take)
				dp[u] = max(dp[u],dp[v]+1);
		}
		ans = max(ans,dp[u]);
	}

	cout<<ans<<"\n";
}

int main() {

	fastIO

	int n,k,inp;
	cin>>n>>k;

	loop(i,0,k) {
		loop(j,0,n) {
			cin>>inp;
			m[i][j] = inp-1;
			pos[i][inp-1] = j;
		}
	}

	solve(n,k);
}


#include<iostream>
#include<vector>
#include<unordered_map>
#include<queue>
#include<cmath>
#include<bitset>
#include<algorithm>
#include<cstring>
#include<utility>
#include<map>
#include<set>
#include<stack>
#include<unordered_set>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define repeat(n) for(int _=0;_<n;_++)
#define arrInp(a,n) loop(i,0,n) cin>>a[i]
#define all(v) v.begin(),v.end()
#define memset(a,v) memset(a,v,sizeof(a));
#define mod int(1e9+7)
#define MAX int(1e5)
#define pb push_back
#define um unordered_map
#define mp make_pair
#define us unordered_set
#define fastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

// Codeforces - Substring - #460 div-2 D

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;

vvi g;
bitset<MAX> visited;
int m[5][1000];
int pos[5][1000];
int dp[1000];

// we have to use dp array since
// 6 2
// 4 3 1 2 5 6
// 1 4 3 2 5 6

ll min(ll a,ll b) {

	return a < b ? a : b;
}

void solve(int n,int k) {

	int ans = 0;
	memset(dp,0);

	loop(u,0,n) {
		loop(v,0,u) {
			bool take = true;
			loop(x,0,k) {
				int a = m[x][u] , b = m[x][v];
				if(pos[x][a] < pos[x][b]) {
					take = false;
					break;
				}
			}
			if(take)
				dp[u] = max(dp[u],dp[v]+1);
		}
		ans = max(ans,dp[u]);
	}

	cout<<ans<<"\n";
}

int main() {

	fastIO

	int n,k,inp;
	cin>>n>>k;

	loop(i,0,k) {
		loop(j,0,n) {
			cin>>inp;
			m[i][j] = inp-1;
			pos[i][inp-1] = j;
		}
	}

	solve(n,k);
}


#include<iostream>
#include<vector>
#include<unordered_map>
#include<queue>
#include<cmath>
#include<bitset>
#include<algorithm>
#include<cstring>
#include<utility>
#include<map>
#include<set>
#include<stack>
#include<unordered_set>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define repeat(n) for(int _=0;_<n;_++)
#define arrInp(a,n) loop(i,0,n) cin>>a[i]
#define all(v) v.begin(),v.end()
#define memset(a,v) memset(a,v,sizeof(a));
#define mod int(1e9+7)
#define MAX int(1e5)
#define pb push_back
#define um unordered_map
#define mp make_pair
#define us unordered_set
#define fastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

// Codeforces - Substring - #460 div-2 D

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;

vvi g;
bitset<MAX> visited;
int m[6][1001];
int pos[6][1001];
int dp[1001];

// we have to use dp array since
// 6 2
// 4 3 1 2 5 6
// 1 4 3 2 5 6

ll min(ll a,ll b) {

	return a < b ? a : b;
}

void solve(int n,int k) {

	int ans = 0;
	memset(dp,0);

	loop(u,1,n+1) {
		loop(v,0,u) {
			bool take = true;
			loop(x,1,k+1) {
				int a = m[1][u] , b = m[1][v];
				if(pos[x][a] < pos[x][b]) {
					take = false;
					break;
				}
			}
			if(take)
				dp[u] = max(dp[u],dp[v]+1);
		}
		ans = max(ans,dp[u]);
	// }

	// for(int i=1;i<=n;i++){
	// 	for(int j=0;j<i;j++){
	// 		bool g=0;
	// 		for(int l=1;l<=k;l++)if (pos[l][m[1][i]]<pos[l][m[1][j]])g=1;
	// 		if (g)continue;
	// 		dp[i]=max(dp[i],dp[j]+1);
	// 	}
	// 	ans=max(ans,dp[i]);
	// }

	cout<<ans<<"\n";
}

int main() {

	fastIO

	int n,k,inp;
	cin>>n>>k;

	loop(i,1,k+1) {
		loop(j,1,n+1) {
			cin>>inp;
			m[i][j] = inp;
			pos[i][inp] = j;
		}
	}

	solve(n,k);
}