#include<bits/stdc++.h> #define SINGLE_INPUT #define ll long long #define N 500005 #define MOD 998244353 usingnamespace std;
voidsol(){ int n; cin >> n; vector<ll> a(n); for (ll& i : a) cin >> i; map<ll, int> mp; for (ll i : a) mp[i]++; int ans = 2; if (mp.count(0)) ans = max(ans, mp[0]); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (i == j || a[i] == 0 && a[j] == 0) continue; int cnt = 2; map<ll, int> c; ll p = a[i], q = a[j]; c[p]++; c[q]++; while (mp.count(p + q) && ++c[p + q] <= mp[p + q]) { int t = p + q; p = q; q = t; cnt++; } ans = max(ans, cnt); } } cout << ans << "\n"; }