#include <iostream>
#include <string>
#include <vector>
#include <cassert>
#include <cstdio>

using namespace std;

string s, t, tmp;

bool check(int l, int r)
{
    for (int i = 0; i <= (r - l) / 2; i++)
        if (s[i + l] != s[r - i])
            return false;
    return true;
}

int main()
{
    freopen("fibstring.in", "r", stdin);
    freopen("fibstring.out", "w", stdout);
    int n;
    cin >> n;

    assert(0 <= n && n <= 80);

    if (n < 3)
    {
        cout << "1\n";
        return 0;
    }                         
    t = 'b';
    s = 'a';
    
    for (int i = 2; i <= n; i++)
    {
        tmp = s;
        s += t;
        t = tmp;
    }
    int si = s.length();
    int ans = 1;
    for (int i = 0; i < si; i++)
        for (int j = i; j < si; j++)
            if (check(i, j)) ans = max(ans, j - i + 1);
    cout << ans; 
}