题意:

Andryusha is an orderly boy and likes to keep things in their place.

Today he faced a problem to put his socks in the wardrobe. He has n distinct pairs of socks which are initially in a bag. The pairs are numbered from 1 to n. Andryusha wants to put paired socks together and put them in the wardrobe. He takes the socks one by one from the bag, and for each sock he looks whether the pair of this sock has been already took out of the bag, or not. If not (that means the pair of this sock is still in the bag), he puts the current socks on the table in front of him. Otherwise, he puts both socks from the pair to the wardrobe.

Andryusha remembers the order in which he took the socks from the bag. Can you tell him what is the maximum number of socks that were on the table at the same time?

Input

The first line contains the single integer n (1 ≤ n ≤ 105) — the number of sock pairs.

The second line contains 2n integers x1, x2, ..., x2n (1 ≤ xi ≤ n), which describe the order in which Andryusha took the socks from the bag. More precisely, xi means that the i-th sock Andryusha took out was from pair xi.

It is guaranteed that Andryusha took exactly two socks of each pair.

Output

Print single integer — the maximum number of socks that were on the table at the same time.

Examples
input
1
1 1
output
1
input
3
2 1 1 3 2 3
output
2

思路:

水题不解释。

实现:

 #include <cstdio>
#include <iostream>
using namespace std;
int cnt[], tmp, n;
int main()
{
cin >> n;
int all = ;
int maxn = -;
for (int i = ; i < * n; i++)
{
cin >> tmp;
cnt[tmp]++;
if (cnt[tmp] == )
all--;
else
all++;
if (maxn < all)
maxn = all;
}
cout << maxn << endl;
return ;
}

最新文章

  1. python datetime处理时间
  2. mysql学习(二)
  3. IE和FF区别关于css和js
  4. js获取项目根路径
  5. 深入.NET平台和C#编程 错题录
  6. 动态更换view类的背景---StateListDrawable的应用
  7. C# 通过ImportNode AppendChild方法合并XmlDocument,XML转为DataTable
  8. ckplayer
  9. Jersey实现Restful服务
  10. Flux和ExtJS MVC框架的异同点介绍
  11. ANIS与UNICODE字符格式转换:MultiByteToWideChar() 和WideCharToMultiByte() 函数
  12. 步步为营-90-SEO(url重写+超链接技巧)
  13. python3 小工具
  14. 设计模式:装饰模式(decorate)
  15. 汇编 SETG,SETL ,SETGE, SETLE指令
  16. SQL Server - 开窗函数
  17. mysql join left join区别
  18. 7.翻译:EF基础系列---EF中的实体类型
  19. numpy和matplotlib绘制直方图
  20. typecho去index.php

热门文章

  1. linunx 下载文件到本地
  2. delphi 八字排盘源码(post数据以后,又分析数据)
  3. Ubuntu下如何安装并使用Objective-C
  4. Map实现缓存
  5. hdu 超级楼梯 解题报告
  6. WAS:启动服务后,server一会挂起。
  7. codeforces 459E E. Pashmak and Graph(dp+sort)
  8. codeforces 673C C. Bear and Colors(暴力)
  9. 如何在XCode中更改iPhone或iPad模拟器类型
  10. 【215】◀▶ IDL 文件操作说明