diff --git a/day 22/day_22_max_n.cpp b/day 22/day_22_max_n.cpp
index ad95d9704e5cc285caafcc1e9931befd756897ac..8e385515d163904e0419a5362808ee54dc66dc1a 100644
--- a/day 22/day_22_max_n.cpp	
+++ b/day 22/day_22_max_n.cpp	
@@ -66,7 +66,7 @@ void solve() {
         rep(i, 1, sz(changes)-3) {
             ll x1 = changes[i], x2 = changes[i+1], x3 = changes[i+2], x4 = changes[i+3];
             string s = to_string(x1) + "," + to_string(x2) + "," +to_string(x3) + "," + to_string(x4);
-            if (mp.count(s) == 0) mp[s] = lasts[i-1];
+            if (mp.count(s) == 0) mp[s] = lasts[i+3];
         }
 
         for (auto p : mp) tot[p.first] += p.second;