opinion: Justice Blackmun
  delivered the opinion of the Court.
  The issue in this case is whether Congress constitutionally may decline to grant Supplemental Security Income benefits to a class of otherwise eligible individuals who are excluded because they are aged 21 through 64 and are institutionalized in public mental institutions that do not receive Medicaid funds for their care. The United States District Court for the Northern District of Illinois held unconstitutional, under the Due Process Clause of the Fifth Amendment, that portion of the Social Security Act, as amended, that excludes these otherwise eligible persons from the supplemental benefits. The Secretary of Health and Human Services has taken a direct appeal to this Court under 28 U. S: C. § 1252.
  I
  In October 1972, Congress amended the Social Security Act (Act) to create the federal Supplemental Security Income (SSI) program, effective January 1, 1974. 86 Stat. 1465, 42 U. S. C. § 1381 et seq. This program was intended “[t]o assist those who cannot work because of age, blindness, or disability,” S. Rep. No. 92-1230, p. 4 (1972), by “set[ting] a Federal guaranteed minimum income level for aged, blind, and disabled persons,” id., at 12.
  The SSI program provides a subsistence allowance, under federal standards, to the Nation’s needy aged, blind, and disabled. Included within the category of “disabled” under the program are all those “unable to engage in any substantial gainful activity by reason of any medically determinable physical or mental impairment which can be expected to result in death or which has lasted or can be expected to last for a continuous period of not less than twelve months.” § 1614 (a)(3)(A) of the Act, 42 U. S. C. § 1382c (a)(3)(A).
  Although the SSI program is broad in its reach, its coverage is not complete. From its very inception, the program has excluded from eligibility anyone who is an “inmate of a public institution.” § 1611 (e) (1) (A) of the Act, as amended, 42 U. S. C. § 1382 (e)(1)(A). Also from the program’s inception, Congress has made a partial exception to this exclusion by providing a small amount of money (not exceeding $300 per year) to any otherwise eligible person in “a hospital, extended care facility, nursing home, or intermediate care facility receiving payments (with respect to such individual or spouse) under a State plan approved under subchapter XIX [Medicaid] ...” § 1611 (e)(1)(B), as amended, 42 U. S. C. § 1382 (e)(1)(B). Congress thus, while excluding generally any person residing in a public institution, explicitly has tied eligibility for a reduced amount of SSI benefits to residence in an institution receiving Medicaid benefits for the care of the eligible individual.
  Appellees brought this suit to challenge this resulting detail of Congress’ having conditioned the limited assistance grant on eligibility for Medicaid: a person between the ages of 21 through 64 who resides in a public mental institution is not eligible to receive this small stipend, even though that person meets the other eligibility requirements for SSI benefits, because treatment in a public mental institution for a person in this age bracket is not funded under Medicaid.
  Appellees attack this statutory classification as violative of the equal protection component of the Fifth Amendment’s Due Process Clause. Their challenge, successful in the District Court, is twofold. First, they argue that the exclusion of their class of mentally ill (and therefore disabled) persons bears no rational relationship to any legitimate objective of the SSI program. They assert, in fact, that their class was excluded inadvertently because of its political powerlessness. Brief for Appellees 6, 32. Second, they insist that because the statute classifies on the basis of mental illness, a factor that greatly resembles other characteristics that this Court has found inherently “suspect” as a means of legislative classification, special justification should be required for the congressional decision to exclude appellees.
  II
  This case has had a somewhat complex procedural history. It initially was instituted in December 1973 as a class action for injunctive and declaratory relief to challenge the federal and Illinois assistance schemes that prevailed prior to, the effective date of the SSI program. See Wilson v. Edelman, 542 F. 2d 1260, 1263-1266 (CA7 1976). The then-existing state assistance program, for which federal funds were received, excluded from eligibility any person who was residing in a public mental or tuberculosis institution or who was confined in a penal institution. Id., at 1263, n. 2. The plaintiffs later amended their complaint to include a challenge to the SSI exclusion, which by then had come into effect. Id., at 1266. A three-judge court was convened under 28 U. S. C. §§2281 and 2282 (1970 ed.) (since repealed by Pub. L. 94-381, §§ 1 and 2, 90 Stat. 1119). The case was consolidated with another that challenged the exclusion from SSI benefits of any pretrial detainee. Relying on Weinberger v. Salfi, 422 U. S. 749 (1975), the court granted the- Secretary’s motion to dismiss both cases for lack of subject-matter jurisdiction on the ground that the plaintiffs had failed to exhaust the administrative remedies provided for by § 1631 (c)(3) of the Act, as amended, 42 U. S. C. § 1383 (c)(3). See 542 F. 2d, at 1267-1268.
  On appeal, appellees abandoned their claims under the prior federal statutes. Id., at 1271. The United States Court of Appeals for the Seventh Circuit reversed the dismissal, holding that the Secretary (then Patricia Harris) had waived any requirement of exhaustion by her submission of the case to the District Court for summary disposition. Id., at 1272. Because the plaintiffs had dropped their request for injunctive relief, the case was remanded to the single-judge District Court. Id., at 1269. That court, on remand, certified the class and granted appellees’ motion for summary judgment, holding that § 1382 (e)’s exclusion of the class members violated the equal protection guarantee of the Due Process Clause of the Fifth Amendment. Sterling v. Harris, 478 F. Supp. 1046 (ND Ill. 1979) . The District Court reasoned that the statute “creates three classifications: (1) age, and (2) residence in a public, (3) mental health hospital.” Id., at 1050. It ruled that Congress’ use of the first two factors need be justified only by demonstration of their “rational relationship” to “a legitimate state interest.” Ibid. Under that standard, these classifications withstood scrutiny. Congress’ use, however, of a “mental health” classification was deemed to require a closer examination because “mental health classifications possess the significant indicia of the suspect classifications recognized in other cases.” Id., at 1052. Although recognizing that the mentally ill as a group do not demonstrate all the characteristics this Court has considered as denoting inherently suspicious classifications, such as race and national origin, the District Court believed that the mentally ill were “a politically impotent, insular minority” that “have been subject to a ‘history of unequal protection.’ ” Ibid. The court therefore concluded that Congress could legislatively disfavor the mentally ill, as § 1611 (e) did, only if the statutory classification passes an “intermediate level of judicial scrutiny,” id., at 1053, that is, only if the “classification bears a substantial relation” to the object of the legislation evaluated “in light of the primary purpose” of the scheme of which it is a part. Ibid. The court adjudged that the “primary purpose” of the small monthly stipend was to enable the needy to purchase comfort items not provided by the institution. Rejecting the Secretary’s proposed justifications for the exclusion, the District Court held that the classification could not withstand scrutiny. The legislative history, it said, revealed no intent to exclude appellees’ class; the court could conceive of no “possible unexpressed purpose for the exclusion”; and the court reasoned that “aged, blind and disabled inmates of all public institutions would have similar needs.” Ibid. Upon the Secretary’s direct appeal from this judgment, we noted probable jurisdiction. Harris v. Wilson, 446 U. S. 964 (1980).
  Ill
  A
  The equal protection obligation imposed by the Due Process Clause of the Fifth Amendment is not an obligation to provide the best governance possible. This is a necessary result of different institutional competences, and its reasons are obvious. Unless a statute employs a classification that is inherently invidious or that impinges on fundamental rights, areas in which the judiciary then has a duty to intervene in the democratic process, this Court properly exercises only a limited review power over Congress, the appropriate representative body through which the public makes democratic choices among alternative solutions to social and economic problems. See San Antonio School District v. Rodriguez, 411 U. S. 1 (1973). At the minimum level, this Court consistently has required that legislation classify the persons it affects in a manner rationally related to legitimate governmental objectives. See, e. g., Dandridge v. Williams, 397 U. S. 471 (1970); Mathews v. De Castro, 429 U. S. 181 (1976). Appellees assert that the particular grant of federal benefits under review here, however, should “be subjected to a heightened standard of review,” Brief for Appellees 39, because the mentally ill “historically have been subjected to purposeful unequal treatment; they have been relegated to a position of political powerlessness; and prejudice against them curtails their participation in the pluralist political system and strips them of political protection against discriminatory legislation.” (Footnote omitted.) Id., at 41.
  We have no occasion to reach this issue because we conclude that this statute does not classify directly on the basis of mental health. The SSI program distinguishes among three groups of persons, all of whom meet the basic eligibility requirements: persons not in a “public institution” may receive full benefits; persons in a “public institution” of a certain nature (“hospital, extended care facility, nursing home, or intermediate care facility receiving payments (with respect to such individual or spouse) . . . under [Medicaid])” (emphasis added), § 1611 (e)(1)(B), may receive reduced benefits; and persons in any other “public institution” may not receive any benefits. The statute does not isolate the mentally ill or subject them, as a discrete group, to special or subordinate treatment. At the most, this legislation incidentally denies a small monthly comfort benefit to a certain number of persons suffering from mental illness; but in so doing it imposes equivalent deprivation on other groups who are not mentally ill, while at the same time benefiting substantial numbers of the mentally ill.
  The group thus singled out for special treatment by § 1611 (e) does not entirely exclude the mentally ill. In fact, it includes, in a sizable proportion to the total population receiving SSI benefits, large numbers of mentally ill people. Further, the group excluded is not congruent with appellees’ class. Among those excluded are the inmates of any other nonmedical “public institution,” such as a prison, other penal institution, and any other publicly funded residential program the State may operate; persons residing in a tuberculosis institution; and residents of a medical institution not certified as a Medicaid provider. Although not by the same subsection, Congress also chose to exclude from SSI eligibility persons afflicted with alcoholism or drug addiction and not undergoing treatment, § 1611 (e) (3) (A), and persons who spend more than a specified time outside the United States, § 1611 (f). See Califano v. Asnavorian, 439 U. S. 170 (1978) (upholding constitutionality of § 1611 (f)) ; Califano v. Tones, 435 U. S. 1 (1978) (upholding constitutionality of Congress’ exclusion from SSI eligibility of residents of Puerto Rico). Thus, in § 1611 (e), Congress made a distinction not between the mentally ill and a group composed of .nonmentally ill, but between residents in public institutions receiving Medicaid funds for their care and residents in such institutions not receiving Medicaid funds.
  To the extent that the statute has an indirect impact upon the mentally ill as a subset of publicly institutionalized persons, this record certainly presents no statistical support for a contention that the mentally ill as a class are burdened disproportionately to any other class affected by the classification. The exclusion draws a line only between groups composed (in part) of mentally ill individuals: those in public mental hospitals and those not in public mental hospitals. These groups are shifting in population, and members of one group can, and often do, pass to the other group.
  We also note that appellees have failed to produce any evidence that the intent of Congress was to classify on the basis of mental health. Appellees admit that no such evidence exists; indeed, they rely on the absence of explicit intent as proof of Congress’ “inattention” to their needs and, therefore, its prejudice against them. Brief for Appellees 39. As in Jefferson v. Hackney, 406 U. S. 635 (1972), the indirect deprivation worked by this legislation upon appellees’ class, whether or not the class is considered “suspect,” does not without more move us to regard it with a heightened scrutiny. Cf. Personnel Administrator of Massachusetts v. Feeney, 442 U. S. 256 (1979).
  B
  Thus, the pertinent inquiry is whether the classification employed in § 1611 (e)(1)(B) advances legitimate legislative goals in a rational fashion. The Court has said that, although this rational-basis standard is “not a toothless one,” Mathews v. Lucas, 427 U. S. 495, 510 (1976), it does not allow us to substitute our personal notions of good public policy for those of Congress:
  “In the area of economics and social welfare, a State does not violate the Equal Protection Clause [and correspondingly the Federal Government does not violate the equal protection component of the Fifth Amendment] merely because the classifications made by its laws are imperfect. If the classification has some ‘reasonable basis,’ it does not offend the Constitution simply because the classification ‘is not made with mathematical nicety or because in practice it results in some inequity.’ Lindsley v. Natural Carbonic Gas Co., 220 U. S. 61, 78.” Dandridge v. Williams, 397 U. S., at 485.
  The Court also has said: “This inquiry employs a relatively relaxed standard reflecting the Court’s awareness that the drawing of lines that create distinctions is peculiarly a legislative task and an unavoidable one. Perfection in making the necessary classifications is neither possible nor necessary.” Massachusetts Bd. of Retirement v. Murgia, 427 U. S. 307, 314 (1976). See also United States Railroad Retirement Bd. v. Fritz, 449 U. S. 166 (1980). As long as the classificatory scheme chosen by Congress rationally advances a reasonable and identifiable governmental objective, we must disregard the existence of other methods of allocation that we, as individuals, perhaps would have preferred.
  We believe that the decision to incorporate the Medicaid eligibility standards into the SSI scheme must be considered Congress’ deliberate, considered choice. The legislative record, although sparse, appears to be unequivocal. Both House and Senate Reports on the initial SSI bill noted the exclusion in no uncertain terms. The House Report stated:
  “People who are residents of certain public institutions, or hospitals or nursing homes which are getting Medicaid funds, would get benefits of up to $25 a month (reduced by nonexcluded income). For these people most subsistence needs are met by the institution and full benefits are not needed. Some payment to these people, though, would be needed to enable them to purchase small comfort items not supplied by the institution. No assistance benefits will be paid to an individual in a penal institution.” H. R. Rep. No. 92-231, p. 150 (1971).
  The Senate Report followed the House’s language almost identically. See S. Rep. No. 92-1230, p. 386 (1972). We find these passages, at the very least, to be a clear expression of Congress’ understanding that the stipend grant was to be limited to a group smaller than the total population of otherwise eligible, institutionalized people. That the bill’s section-by-section analysis contained in the House Report laid out the terms of the exclusion precisely supports the conclusion that Congress was aware of who was included in that limited group. See H. R. Rep. No. 92-231, at 334.
  The limited nature of Medicaid eligibility did not pass unnoticed by the enacting Congress. In the same bill that established the SSI program, Congress considered, and passed, an amendment to Medicaid, providing coverage of inpatient services to a large number of the juvenile needy in public mental institutions. See § 1905 (h) of the Act, 42 U. S. C. § 1396d (h); S. Rep. No. 92-1230, at 280-281; H. R. Conf. Rep. No. 92-1605, p. 65 (1972). Also, a Senate proposal for demonstration projects on the feasibility of extending Medicaid to cover all inpatient services provided in public mental institutions was simultaneously defeated. See S. Rep. No. 92-1230, at 281; H. R. Conf. Rep. No. 92-1605, at 65. Congress was in the process of considering the wisdom of these limitations at the time it chose to incorporate them into the SSI provisions. The decision to do so did not escape controversy. The Committee hearings contained testimony advocating extension of both Medicaid and SSI benefits to all needy residents in public mental institutions. See Social Security Amendments of 1971, Hearings on H. R. 1 before the Senate Committee on Finance, 92d Cong., 1st and 2d Sess., 2180, 2408-2410, 2479-2485, 3257, 3319 (1972). This legislative history shows that Congress was aware, when it added § 1611 (e) to the Act, of the limitations in the Medicaid program that would restrict eligibility for the reduced SSI benefits; we decline to regard such deliberate action as the result of inadvertence or ignorance. See Maine v. Thiboutot, 448 U. S. 1, 8 (1980).
  Having found the adoption of the Medicaid standards intentional, we deem it logical to infer from Congress’ deliberate action an intent to further the same subsidiary purpose that lies behind the Medicaid exclusion, which, as no party denies, was adopted because Congress believed the States to have a “traditional” responsibility to care for those institutionalized in public mental institutions. The Secretary, emphasizing the then-existing congressional desire to economize in the disbursement of federal funds, argues that the decision to limit distribution of the monthly stipend to inmates of public institutions who are receiving Medicaid funds “is rationally related to the legitimate legislative desire to avoid spending federal resources on behalf of individuals whose care and treatment are being fully provided for by state and local government units” and “may be said to implement a congressional policy choice to provide supplemental financial assistance for only those residents of public institutions who already receive significant federal support in the form of Medicaid coverage.” Brief for Appellant 27-28. We cannot say that the belief that the States should continue to have the primary responsibility for making this small “comfort money” allowance available to those residing in state-run institutions is an irrational basis for withholding from them federal general welfare funds.
  Although we understand and are inclined to be sympathetic with appellees’ and their supporting amici’s assertions as to the beneficial effects of a patient’s receiving the reduced stipend, we find this a legislative, and not a legal, argument. Congress rationally may elect to shoulder only part of the burden of supplying this allowance, and may rationally limit the grant to Medicaid recipients, for whose care the Federal Government already has assumed the major portion of the expense. The limited gratuity represents a partial solution to a far more general problem, and Congress legitimately may assume that the States would, or should, provide an equivalent, either in funds or in basic care. See Baur v. Mathews, 578 F. 2d 228, 233 (CA9 1978). This Court has granted a “strong presumption of constitutionality” to legislation conferring monetary benefits, Mathews v. De Castro, 429 U. S., at 185, because it believes that Congress should have discretion in deciding how to expend necessarily limited resources. Awarding this type of benefits inevitably involves the kind of line-drawing that will leave some comparably needy person outside the favored circle. We cannot say that it was irrational of Congress, in view of budgetary constraints, to decide that it is the Medicaid recipients in public institutions that are the most needy and the most deserving of the small monthly supplement. See, e. g., Califano v. Boles, 443 U. S. 282, 296 (1979); Califano v. Jobst, 434 U. S. 47, 53 (1977); Weinberger v. Salfi, 422 U. S. 749, 768-770 (1975); Richardson v. Belcher, 404 U. S. 78, 83-84 (1971).
  We conclude that Congress did not violate appellees’ rights to equal protection by denying them the supplementary benefit. The judgment of the District Court is reversed.
  It is so ordered.
  The SSI program, Title XYI of the Social Security Act, largely replaced the prior system of federal grants to state-run assistance programs for the aged, blind, and disabled contained in Titles I, X, XIV, and XVI of the Act, that is, Old Age Assistance, 49 Stat. 620, as amended, 42 U. S. C. §301 et seq.; Aid to the Blind, 49 Stat. 645, as amended, 42 U. S. C. § 1201 et seq.; Aid to the Permanently and Totally Disabled, 64 Stat. 555, as amended, 42 U. S. C. § 1351 et seq.; and Aid to the Aged, Blind, or Disabled, 76 Stat. 197, 42 U. S. C. § 1381 et seq. (1970 ed.). See Califano v. Aznavorian, 439 U. S. 170, 171 (1978); Califano v. Torres, 435 U. S. 1, 2 (1978).
  To be eligible for SSI benefits, a person must be “aged,” that is, 65 or older, or “blind,” or “disabled,” as those terms are defined in § 1614 of the Act, as amended, 42 U. S. C. § 1382c, and his income and resources must be below the levels specified in § 1611 (a), as amended, 42 U. S. C. §1382 (a).
  Section 1611 (e)(1)(A), as amended, provides:
  “(e) Limitation on eligibility of certain individuals
  “(1) (A) Except as provided in subparagraph (B) and (C), no person shall be an eligible individual or eligible spouse for purposes of this sub-chapter with respect to any month if throughout such month he is an inmate of a public institution.”
  Section 1611 (e)(1)(B), as amended, modifying §1611 (e)(1)(A), as amended, states:
  “(B) In any case where an eligible individual or his eligible spouse (if any) is, throughout any month, in a hospital, extended care facility, nursing home, or intermediate care facility receiving payments (with respect to such individual or spouse) under a State plan approved under title XIX, the benefit under this title for such individual for such month shall be payable—
  “(i) at a rate not in excess of $300 per year (reduced by the amount of any income not excluded pursuant to section 1612 (b)) in the case of an individual who does not have an eligible spouse;
  “(ii) in the case of an individual who has an eligible spouse, if only one of them is in such a hospital, home or facility throughout such month, at a rate not in excess of the sum of—
  “(I) the rate of $300 per year (reduced by the amount of any income, not excluded pursuant to section 1612 (b), of the one who is in such hospital, home, or facility), and
  “(II) the applicable rate specified in subsection (b)(1) (reduced by the amount of any income, not excluded pursuant to section 1612 (b), of the other); and
  “(iii) at a rate not in excess of $600 per year (reduced by the amount of any income not excluded pursuant to section 1612 (b)) in the case of an individual who has an eligible spouse, if both of them are in such a hospital, home, or facility throughout such month.”
  Subsection (C) of §1611 (e)(1), not implicated in this case, further modifies §1611 (e)(1)(A), as amended, by providing:
  “(C) As used in subparagraph (A), the term ‘public institution’ does not include a publicly operated community residence which serves no more than 16 residents.”
  Added in 1976 by Pub. L. 94-566, § 505 (a), 90 Stat. 2686, this subsection met objections that § 1611 (e) impeded reform efforts to de-institu-tionalize certain groups of handicapped individuals, such as the mentally retarded. Congress determined to encourage the establishment of state-run group homes for such people by making residents in these institutions eligible for SSI benefits. See S. Rep. No. 94-1265, p. 29 (1976); H. R. Conf. Rep. No. 94-1745, pp. 27-28 (1976).
  Federal funds are available under the Medicaid program to pay for the following “residential” services: “inpatient hospital services (other than services in an institution for tuberculosis or mental diseases),” § 1905 (a)(1), 42 U. S. C. § 1396d (a) (1); “skilled nursing facility services (other than services in an institution for tuberculosis or mental diseases) for individuals 21 years of age or older,” § 1905 (a) (4) (A); “inpatient hospital services, skilled nursing facility services, and intermediate care facility services for individuals 65 years of age or over in an institution for tuberculosis or mental diseases,” § 1905 (a) (14); “intermediate care facility services (other than such services in an institution for tuberculosis or mental diseases) for individuals ... in need of such care,” § 1905 (a) (15); certain “inpatient psychiatric hospital services for individuals under age 21,” §§ 1905 (a) (16) and (h). Subsection (17) (B) of §1905 (a), which provides for funding of any other medical or remedial care recognized under state law, specifically excludes “payments with respect to care or services for any individual who has not attained 65 years of age and who is a patient in an institution for tuberculosis or mental diseases.”
  In 1950, when it first enacted federal grants for medical assistance, Congress excluded “any individual . . . who is a patient in an institution for . . . mental diseases” from eligibility. 64 Stat 558. This exclusion was incorporated into the Medicaid statute in 1965, 79 Stat. 352, but exceptions were made for the needy aged in mental institutions, and for the care of mentally ill persons in general medical facilities. Ibid. In 1972, in the bill enacting the SSI program, Congress further broadened Medicaid benefits for the mentally ill to include most children in mental institutions. 86 Stat. 1461. A Senate proposal for demonstration projects to investigate the possibility of extending Medicaid benefits to the mentally ill between the ages of 21 through 64 in mental hospitals was defeated at that time. See S. Rep. No. 92-1230, p. 281 (1972); H. R. Conf. Rep. No. 92-1605, p. 65 (1972).
  This Court repeatedly has held that the Fifth Amendment imposes on the Federal Government the same standard required of state legislation by the Equal Protection Clause of the Fourteenth Amendment. See, e. g., Weinberger v. Salfi, 422 U. S. 749, 768-770 (1975); Richardson v. Belcher, 404 U. S. 78, 81 (1971).
  The three-judge court also found that the state statute classified on the basis of age, not mental health, and that it was rational and constitutional. The Court of Appeals declined to review that constitutional holding on the ground that review from the three-judge court could be had only in this Court. Wilson v. Edelman, 542 F. 2d, at 1276-1282.
  The Court of Appeals also held that only two of the named plaintiffs, Maudie Simmons and John Kiernan Turney, had satisfied the minimum, nonwaivable requirement of 42 U. S. C. § 405 (g) that a party may seek review only of a “final decision of the Secretary” denying, terminating, or suspending benefits under the SSI program. The other named plaintiffs, including Charles Wilson, were eligible for, or had sought and been denied, benefits only under the prior cooperative state-federal programs, and therefore they were dismissed as parties. We have retained Wilson as a named party in the caption of this case, however, as did the District Court on remand, for the sake of uniformity.
  The class was defined as “all persons residing in HEW Region V who have been terminated from benefits under Title XVI, or who have applied for Supplemental Security Income benefits under Title XVI and have been denied such benefits, on or after January 1, 1974, solely because they are between the ages of 21 and 65 and hospitalized in a public mental institution.” App. to Juris. Statement 21a.
  The District Court denied, however, the claim of the pretrial detainees to the monthly stipend, applying a “rational relation” standard and finding the exclusion rational because “[t]he detainee status is necessarily temporary in nature, and the [Secretary] could legitimately wish to withhold these extra-subsistence payments while the detainee is housed in a public institution and until his future status is determined.” 478 F. Supp., at 1055.
  The District Court noted that a person’s mental health problem, especially one that has led to institutionalization, is likely to ‘"bear [a] relation to ability to perform or contribute to society.’ ” Id., at 1051-1052, quoting Frontiero v. Richardson, 411 U. S. 677, 686 (1973). The court also acknowledged that “[i]t is debatable whether and to what extent the mental illness is an ‘immutable characteristic determined solely by the accident of birth.’” 478 F. Supp., at 1052, again quoting Frontiero, 411 U. S., at 686.
  The Secretary argued that the statutory exclusion has three purposes: “1) the conservation of federal resources; 2) the concern that federal funds be received on behalf of residents of qualified institutions; and 3) the fact that plaintiffs are not ‘similarly situated’ with Medicaid patients in terms of federal interest and control.” 478 F. Supp., at 1053.
  We therefore intimate no view as to what standard of review applies to legislation expressly classifying the mentally ill as a discrete group.
  Social Security Administration statistics show that 30.7% of all blind and disabled adult persons awarded SSI benefits in 1975 (109,509 persons) were deemed disabled by mental disorders, and the Administration has concluded that “[m]ental illness was the most common cause of disability in 1975.” Kochhar, Blind and Disabled Persons Awarded Federally Administered SSI Payments, 1975, Social Security Bulletin 13, 15 (June 1979). Half of this number suffered from mental illness rather than mental retardation, and these statistics did not include any persons with prior entitlement to benefits. Ibid.
  Further, as a recent study also indicates, a substantial number of mentally ill people in institutions actually receive SSI benefits. Social Security Administration, Representative Payments under the SSI Program, August 1977, Research and Statistics Note No. 9 (Sept.. 16, 1980). This study established that 15% of the total population receiving SSI benefits (for all reasons, including age, blindness, and disability) had “representative payees” (a person “appointed to manage the benefits of an adult beneficiary” because of “the adult beneficiary’s inability to manage his own funds”). Id., at 1. Out of a total of 184,133 institutionalized persons who were receiving SSI benefits in August 1977 through such “representative payees,” 76,494, or approximately 41%, were institutionalized because of mental disorders. Id., at 7 (Table 6) and 2 (Table 1). Thus, even on this incomplete data, a sizable number of SSI recipients were persons institutionalized for mental illness.
  Appellees appear to concede the rationality of Congress’ general exclusion of publicly institutionalized persons from full SSI benefits.
  An otherwise eligible person does not receive SSI benefits if he is receiving long-term treatment in a medical facility that is not certified under Medicaid standards as a provider. See § 1861 of the Act, 42 U. S. C. § 1395x. These strict standards exclude many facilities but work to the ultimate benefit of those receiving Medicaid Cf. O’Bannon v. Town Court Nursing Center, 447 U. S. 773 (1980).
  The average inpatient stay in public mental hospitals is short. Recently collected data for 1975 reveal a median stay in state and county mental hospitals of only 25.5 days. Witkin, Characteristics of Admissions to Selected Mental Health Facilities, 1975: An Annotated Book of Charts and Tables, National Institute of Mental Health 93, DHHS Publication No. (ADM) 80-1005 (1981). This study also showed that young and elderly patients had longer periods of stay than patients in the middle-age group. Id.., at 95. The rapidity with which inpatients are released from public institutions has increased since the 1950’s. In 1971 75% of all patients admitted to state mental hospitals were released within the first three months, while 87% were released within the first six months. Ozarin, Redick, & Taube, A Quarter Century of Psychiatric Care, 1950-1974: A Statistical Review, 27 Hospital & Community Psychiatry 515, 516 (1976). Data from the National Institute of Mental Health show that the proportion of “patient care episodes” (admissions during a year plus residents at the beginning of the year) attributable to inpatient treatment at state and county hospitals declined from 49% in 1955 to 9% in 1977. This dramatic decrease in the percentage of persons admitted to these hospitals was paralleled by a growth in treatment through outpatient and community mental health facilities; that percentage grew from 23% in 1955 to 76% in 1977. Witkin, Trends in Patient Care Episodes in Mental Health Facilities, 1955-1977, National Institute of Mental Health, Mental Health Statistical Note No. 154, p. 3 (Sept. 1980). At the same time, the total number of “patient care episodes” increased fourfold, from approximately 1.7 million in 1955 to 6.9 million in 1977. Id., at 1.
  To be eligible for Medicaid reimbursement for inpatient services, mentally ill persons under the age of 21 being treated in mental institutions must be receiving “active treatment” that meets standards prescribed by the Secretary and that “can reasonably be expected to improve the condition, by reason of which such services are necessary, to the extent that eventually such services will no longer be necessary.” § 1905 (h)(1)(B) of the Act, 42 U. S. C. § 1396d (h) (1) (B).
  The Medicaid limitation was based on Congress’ assumption that the care of persons in public mental institutions was properly a responsibility of the States. See H. R. Rep. No. 1300, 81st Cong., 1st Sess., 42 (1949) (enacting federal funding for services to the needy aged, blind, and disabled provided in public medical institutions, but excluding assistance to those in “public or private institutions for mental illness and tuberculosis, since the States have generally provided for medical care of such cases”); S. Rep. No. 404, 89th Cong., 1st Sess., pt. 1, pp. 144-147 (1965) (enactment of Medicaid providing coverage only to the aged needy in mental or tuberculosis institutions; noting that “[t]he reason for this exclusion was that long-term care in such hospitals had traditionally been accepted as a responsibility of the States,” id., at 144). This exclusion was upheld in Legion v. Richardson, 354 F. Supp. 456 (SDNY), summarily aff’d sub nom. Legion v. Weinberger, 414 U. S. 1058 (1973), and Kantrowitz v. Weinberger, 388 F. Supp. 1127 (DC 1974), aff’d, 174 U. S. App. D. C. 182, 530 F. 2d 1034, cert. denied, 429 U. S. 819 (1976), and appellees disavow any intention to dispute that holding. Brief for Appellees 26-27; Tr. of Oral Arg. 19.
  Whether a State chooses to elect or not to elect to provide an equivalent monthly stipend to institutionalized mental patients does not alter the rationality of Congress’ decision.
  The Secretary has interpreted §1611 (e)(1)(B) to require that at least 50% of the cost of services be reimbursed by Medicaid before the reduction of benefits becomes effective. 20 CFR §416.231 (b) (5) (1980).
  Congress continues to investigate other more general solutions and to 'propose alterations in § 1611 (e). See H. R. Rep. No. 96-451, pt. 1, p. 153 (1979); 125 Cong. Rec. 31349-31350, 31354-31355, 31356 (1979) (remarks of Rep. Corman, Rep. Pepper, and Rep. Bingham) (proposing amendment to § 1611 (e) to forestall reduction of benefits until after eligible individual has been institutionalized in a Medicaid institution for three months); Staff of the Senate Committee on Finance, The Supplemental Security Income Program, 95th Cong., 1st Sess., 109-115 (Comm. Print 1977) (advocating legislative amendments standardizing the monthly stipend to institutionalized persons).
  “When a legal distinction is determined, as no one doubts that it may be, between night and day, childhood and maturity, or any other extremes, a point has to be fixed or a line has to be drawn, or gradually picked out by successive decisions, to mark where the change takes place. Looked at by itself without regard to the necessity behind it the line or point seems'arbitrary. It might as well or nearly as well be a little more to one side or the other. But when it is seen that a line or point there must be, and that there is no mathematical or logical way of fixing it precisely, the decision of the legislature must be accepted unless we can say that it is very wide of any reasonable mark.” Louisville Gas Co. v. Coleman, 277 U. S. 32, 41 (1928) (Holmes, J., dissenting).
  The amount of money, and the number of people potentially involved, are not inconsiderable. Although the appellees do not agree, the Secretary estimates that the annual cost of implementing the District Court’s order nationwide would approximate $30 million. Beply Memorandum for Appellant 3. In 1979, a total of almost 2.2 million people were receiving SSI benefits for disabilities, an increase of over 900,000 from January 1974. See Social Security Bulletin 49 (Table M-24) (June 1979). Further, of all the disabled adults who applied for benefits between January 1974 and July 1975, 1.1% were denied eligibility by reason of their residence in a public institution. See S. Bep. No. 95-1312, p. 7 (table) (1978).