/* -*- coding: utf-8 -*- * * 3543.cc: No.3543 Progression (All Language) - yukicoder */ #include #include using namespace std; /* constant */ const int MAX_N = 2000; /* typedef */ /* global variables */ int as[MAX_N], bs[MAX_N]; /* subroutines */ /* main */ int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", as + i); if (n <= 2) { printf("%d\n", n); return 0; } for (int i = 0; i + 1 < n; i++) bs[i] = as[i + 1] - as[i]; int m = n - 1; int maxl = 0; for (int i = 0; i < m;) { int j = i; while (i < m && bs[j] == bs[i]) i++; maxl = max(maxl, i - j + 1); } printf("%d\n", maxl); return 0; }